Hi,
I have 2 vector of x, y coodinates of points
x=[0 50 935 1870 1935 2805 3740 4675 5610 6545 6746 7480 7911 8415 8590 9004];
y=[300 600 716 892 900 990 1052 1071 1037 934 900 736 600 393 300 0];
length(x)=length(y)=16.
The first curve is generated by plot(x,y).
Because I want to smooth the orginal curve. From x, y vectors, I want to generate x', y' vectors with length(x')=length(y')=101. And the second curve is generated by plot(x',y').
Could someone please help me to do this?
I also created a script to do it, but the result wasn't same as the one I want.
My script:
clcclear allx=[0 50 935 1870 1935 2805 3740 4675 5610 6545 6746 7480 7911 8415 8590 9004];y=[300 600 716 892 900 990 1052 1071 1037 934 900 736 600 393 300 0];plot(x,y,'-o');xnew=linspace(x(1),x(end),101);ynew=spline(x,y,xnew);figureplot(xnew,ynew,'--o');
The curve generated by plot(x,y):
The curve generated by plot(x',y'):
The result I want to get:
Khanh.
Best Answer