x= Generate 6 equally spaced data points x, which starts from 1 and ends at 15.
y = 2 x − 3
x2= Generate 40 equally spaced data points x2, which starts from 1 and ends at 15.
y2=Use linear interpolation to find theintermediate function values (y2) for x2 and generate a plot showing data pairs (x1, y1) as well as (x2, y2). In the plot, please title, label, legend and use color style appropriately.
CODE:
y2=interp1(x,y,x2,'linear');
plot(x,y,'rx',x2,y2,'bo');
legend('original data','interpolation data');
1 Comment
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/683273-a-problem-containing-interpolation#comment_1188708
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/683273-a-problem-containing-interpolation#comment_1188708
Sign in to comment.