How to get an approximately value with number data with specified polynomial in MatLab? - polyfit -- MatLab

 How to  get an approximately value with number data with specified polynomial in MatLab? - polyfit -- MatLab


How to  get an apprixmate value with number data with specified polynomial in MatLab?

[Ans]

polyfit

[syntax]


[description]

It will return approximately value with x-axis data <x> and y-axis data <y> which is represented with degree n of the polynomial.

<p>
coefficient of polynomial

<S>
structure of polynomial

<mu>
population of mean in distribution

more details about mu (one of Greek Letters) on:

more details on:

code

clear
clc
x = linspace(0,4*pi,10);
y = sin(x);
p = polyfit(x,y,7)
%{
p =
-0.0001 0.0028 -0.0464 0.3702 -1.3808 1.9084 -0.1141 0.0002
%}
x1 = linspace(0,4*pi);
y1 = polyval(p,x1);
figure
plot(x,y,'o')
hold on
plot(x1,y1)
hold off

output

                    
coefficient polynomial


                                figure

Comments