Answered
Plotting outputs from a function on one figure using for loop
YOu should follow some thing like shown below: friction= 0.1 : 0.05 : 0.65 ; initialelevation= 100 : 15 : 200 ; function[v...

7 years ago | 0

Answered
I have to write my own cosine function.
Note that you can represent the above series as follows: With the above it makes easy to write your function. As this ...

7 years ago | 1

Answered
plotting a derivative of a function using surf command
X=-10:.1:10; T=-10:.1:10; mu1=-.01+1*1i; a=(.1-2*1i); b=(.1-.1*1i); [x,t]=meshgrid(X,T); x1=exp(-1i*mu1.*x).*exp((1-(1i./(...

7 years ago | 0

Answered
region extraction from a text document Image
I = imread('Page_body.png'); results = ocr(I); str = results.Text

8 years ago | 0

Answered
How to plot existing x,y,z points?
A = [0.5000 0.5000 66.9052 0.5000 1.0000 57.3591 1.0000 0.5000 76.7805 1.0000 1.0000 66.9052] ; x = A(:,...

8 years ago | 0

Answered
How to generate data
x = 0:0.01:5 ; y = 0:0.01:3 ; [X,Y] = meshgrid(x,y) ; iwant = [X(:) Y(:)]

8 years ago | 1

| accepted

Answered
select a random number from each row in a matrix with changable columns
rows = 256 ; cols = randsample(rows,1) ; A = rand(rows,cols) ; % Select a row randomly idx = randsample(rows,1) ; A(id...

8 years ago | 1

Answered
Plane Fitting a 3D Scatter Plot
x = [14.9 1.7 0.0 10.9 0.0]; y = [11.3 9.1 23.7 12.8 2.9]; z = [5.32787E-17 2.93234E-16 2.09997E-16 5.45E-17 4.55E-16]; nx ...

8 years ago | 0

Answered
merge cell data in cell
result = [A ,B ,C] ;

8 years ago | 0

Answered
Analyzing Atomic Force Microscope data using MATLAB
[num,txt,raw] = xlsread(myfile) ; [ny,nx] = size(num) ; L = 20 ; % micrometer B = 20 ; % micrometer x = linspace(0,L,n...

8 years ago | 1

| accepted

Answered
How can I rotate the blue figure 8 curve to approximately match the black figure 8?
YOu can rotate your points to desired angle using rotation matrices. Refer here: https://en.wikipedia.org/wiki/Rotation_matrix ...

8 years ago | 1

Answered
Finite Element Analysis (FEA) Truss Analysis
Useful file exchange function: https://in.mathworks.com/matlabcentral/fileexchange/14313-truss-analysis

8 years ago | 1

Answered
How to append a row vector to the variable?
Add them into the cell and later you can reshape to what you want. Read about Cells Get the size of the array if row is one i...

8 years ago | 1

| accepted

Answered
split a video and save them randomly in a new vedio
vidObj = VideoReader(myvideo); % video file name numFrames = 0; iwant = cell([],1) ; % to save FRames while hasFrame(vid...

8 years ago | 0

Answered
Alternative for a for loop. How would I write this code without using a for loop to save some computation time?
Read about MTLAB element by element opeartions...I guess .* should work in your case. Also have a look on arrayfun

8 years ago | 0

Answered
I am getting an error that "array indices must be positive integers or logical values" How to solve?
Note that MATLAB accepts only non zero positive integers and logicals as indices. Else from these every thing throws error. ...

8 years ago | 0

Answered
How can Matlab tell the difference between edges with enclosed boundaries or not?
For the first object, you may try to arrange the points of boundaries in an order i.e clock wise or anti clock wise. You can do...

8 years ago | 0

Answered
How can simply divide a linear array into 32 equal parts?
A = rand(1,247) ; % you data a = length(A) ; n = 32 ; b = a + (n - rem(a,n)) ; % Get number divisible by 32 ...

8 years ago | 0

Answered
how to count values of a particular day in a timeseries data?
Read about datevec. Datetime can be converted to years, monhts, days, hours, minuites and seconds......from this you can count w...

8 years ago | 0

Answered
plot with if else command
Check the demo example. figure hold on for i = 1:10 x = rand ; if x < 0.5 plot(i,x,'*r') else ...

8 years ago | 0

| accepted

Answered
how to crop an image equally
I = imread('Im592.jpg') ; [ny,nx,nz] = size(I) ; [X,Y] = meshgrid(1:nx,1:ny) ; C = round([nx/2 ny/2]) ; % center R = a...

8 years ago | 1

| accepted

Answered
create new array with for
A = zeros(2,5) ; for z=1:5 A(:,z) = [1;3*z] ; end A(:,1) % this is A1 A(:,3) % this is A3 It is useless to geenrat...

8 years ago | 0

| accepted

Answered
I've attached a drawing using Mathematica and want the following graph to be exactly the same
x = linspace(0,50,1000) ; y = 0.2*sin(x) ; plot(x,y,'.b')

8 years ago | 1

| accepted

Answered
what I have to do to solve the error "Invalid or deleted object." while creation of histogram?
Dont close the figure.....if you close the figure obviously you will get this error.

8 years ago | 1

Answered
Creating Curve from Moving Point
hold on axis ([-20 20 -20 20]) axis off P1=[-11,0]; P2=[-1,0]; h{1}=plot([P1(1) P2(1)],[P1(2) P2(2)],'LineWidth',5,'Color',...

8 years ago | 0

| accepted

Answered
Connecting points in a scatter plot and measuring the angle
For points (x1,y1) and (x2,y2) use atan2(y2-y1,x2-x1) to get angle. Use plot to plot them as a line.

8 years ago | 0

| accepted

Answered
How to preserve column titles from a table created with array2table when I copy and paste into excel
Dont copy paste........you need not to convert table to an array. You can straight away table into a excel file using writetable...

8 years ago | 0

| accepted

Answered
How can I store data from a loop when the data is negative?
function xint = findxint(a,b,c,z) c = [a b c z]; xmin = -100; xmax = +100; n = 50; dx = (xmax - xmin) / n; % dx=4 xL = x...

8 years ago | 0

Answered
How to change 2D image(jpg) into 3D?
I = rgb2gray(imread('peppers.png')) ; [ny,nx] = size(I) ; [X,Y] = meshgrid(1:nx,1:ny) ; figure ax = gca; surf(X,Y,I) shadi...

8 years ago | 0

Load more