Cubic Spline Fit-Just confirm the code

5 Ansichten (letzte 30 Tage)
manish sharma
manish sharma am 11 Jul. 2012
Hi,
I have two vectors, X, and Y (of same size).
Now, I am interested in cubic spline fit of the data points (Y) at certain values (let's call this vector as "x") by the code:
-------------------------------
x = 1:1:125;
y = interp1(X,Y, x,'spline')
plot(x,y,'--r')
-------------------------------
PLEASE CONFIRM:
The "plot (x,y,'--r')" command will give the cubic spline fit for data points (represented in Y), right?

Akzeptierte Antwort

John Petersen
John Petersen am 11 Jul. 2012
right. You can verify this by
plot(X,Y,,'.',x,y);legend('Samples','Spline')

Weitere Antworten (0)

Kategorien

Mehr zu Splines finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by