0% found this document useful (0 votes)
5 views1 page

Interpolating Curves in MATLAB Plot

This document contains Matlab code that plots an interpolating curve, exact curve, and data points on the same graph. It defines x-values and y-values for the data points, generates x- and y-values for the interpolating and exact curves, and plots all three on the same graph with labels and a legend identifying each curve and the data points.

Uploaded by

MohammedHejazi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Interpolating Curves in MATLAB Plot

This document contains Matlab code that plots an interpolating curve, exact curve, and data points on the same graph. It defines x-values and y-values for the data points, generates x- and y-values for the interpolating and exact curves, and plots all three on the same graph with labels and a legend identifying each curve and the data points.

Uploaded by

MohammedHejazi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

clear all

x1=[0 1 2 3];
y1=[3 2.5 1.4 0.9];
x= 0:0.0001:3;
y=0.2*x.^3-0.9*x.^2+0.2*x+3;
yexact=(2*x+3)./(x.^2+1);
plot(x,y,'r',x,yexact,'b',x1,y1,'*')
xlabel('The values of x');
ylabel('The values of the function');
legend('The interpolating curve','The exact curve','The given data');
title('Interpolating curves of exact function')

You might also like