MATLAB: Plotting doubt: making a curve with points

plot line

Hi all, I have the following code:
figure
COPlin=Y./Yg;
plot(AATnew,COPlin)
axis([-10 80 0 1])
I want to make a curve, but Matlab is doing lot of lines between the points. What I want to obtain is a unique curve that put together all the points.
I would be glad if you could help me:)

Best Answer

I am not exactly certain what the problem is, but if my guess is correct, the sort function may be the solution:
AATnew = randi(90,20,1)-10; % ‘AATnew’ is a (20x1) array
COPlin = rand(20,1); % ‘COPlin’ is a (20x1) array
[Ms,Mi] = sort(AATnew); % Sort ‘AATnew’, keeping indices
figure(1)
plot(AATnew,COPlin,'-*') % Plot Original UNSORTED data
grid
figure(2)
plot(AATnew(Mi),COPlin(Mi),'-*') % Plot SORTED data
grid