You want to fit the data ti Vj in the table above with a str

You want to fit the data (t_i, V_j) in the table above with a straight line model. Write out how you would use the polyfit command to get the equation for the line: (i) Write the exact command you would use, starting with P = (ii) Write out the values of all the variables you would use as an input to the command (iii) Type your command into MATLAB, write out your result for P, and write out the equation of the best-fit line based on the values in your P.

Solution

Polynomial Curve fitting-polyfit

i) The exact command for polyift is :

P=polyfit(t,V,n)

p = polyfit(t,V,n) returns the coefficients for a polynomial p(t) of degree n that is a best fit (in a least-squares sense) for the data in y. The coefficients in p are in descending powers, and the length of p is n+1

iI)

Use polyfit to fit a nth-degree polynomial to the points.

Example :

Generate 10 points equally spaced along a sine curve in the interval [0,4*pi].

x = linspace(0,4*pi,10);

 You want to fit the data (t_i, V_j) in the table above with a straight line model. Write out how you would use the polyfit command to get the equation for the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site