Interpolation and Curve Fitting

  1. The MATLAB procedure for polynomial least-squares is polyfit. Study the following example;
    x =(0:0.1:5)'; 					% x from 0 to 5 in steps of 0.1
    y = sin(x); 						% get y values
    p = polyfit(x,y,3); 		% fit a cubic to the data
    f = polyval(p,x); 			% evaluate the cubic on the x data
    plot(x,y,'o',x,f,'-') 	% plot y and its approximation f
    
  2. For the given data points;

    \begin{displaymath}
\begin{array}{rr}
x & Y \\ \hline
0.000 & 1.500 \\
0.142 & ...
...714 & 0.821 \\
0.857 & 0.442 \\
1.000 & 0.552 \\
\end{array}\end{displaymath}

  3. Apply the procedure given in the first item by using the data set in the previous item.


2004-12-03