Posted By:
31 Mar, 2013 9:15 pm PDT

simple polynomial fitting or interpolation for given set of points using matlab

I have the following data sets, which shows the value of y for corresponding values of x

y x
0 1
1 3
2 4
3 8

I want to fit a 2nd or 3rd order polynomial eg. y = a + bx + cx^2 + dx^3. that means that I need to find the values of a, b, c, and d. how can I do it in an easy way. I dont care for computation and all.


its a simple method to find the coefficients of the polynomial. For the third order method, the code is:

x = [0;2;4;8];
y = [0;1;2;3];

for i=1:length(x)
    A(:,i) = x.^(i-1);
b = y;
poly_parameters = A\b

Please watch the video and attached .m file for details**********

Attachment: poly_fit_simple.m
Was it useful?  

Please login to reply to this problem.