Ejemplo: X (1 2 3) y (0 1 - 1) D Polyfit (X, Y, Length (X) - 1)

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Ejemplo:

x=[1 2 3];

>> y=[0 1 -1];

>> d=polyfit(x,y,length(x)-1)

d=

-1.5000 5.5000 -4.0000

>> d1=polyder(d)

d1 =

-3.0000 5.5000

>> polyval(d1,0)

ans =

5.5000

>> d2=polyder(d1)

d2 =

-3.0000

>> polyval(d2,0)
ans =

-3.0000

>> x=[1 2 3];

>> y=[3 2 1 5];

>> d=polyfit(x,y,length(x)-1)

??? Error using ==> polyfit at 48

X and Y vectors must be the same size.

>> x=[1 2 3];

>> y=[0 1 -1];

>> d=polyfit(x,y,length(x)-1)

d=

-1.5000 5.5000 -4.0000

>> d1=polyder(d)

d1 =

-3.0000 5.5000

>> polyval(d1,-2)

ans =

11.5000
>> d2=polyder(d1)

d2 =

-3.0000

>> polyval(d2,-2)

ans =

-3.0000

>> xd=

You might also like