Spline and PPL discrete points

6 Ansichten (letzte 30 Tage)
Dhruv Tripathi
Dhruv Tripathi am 21 Mär. 2020
Bearbeitet: Dhruv Tripathi am 21 Mär. 2020
I am given data sets v and r to spline over an interval and graph. I have to use spline and ppl intervals to accomplish this however when I do this the spline is nothing like the data plot.

Akzeptierte Antwort

David Goodmanson
David Goodmanson am 21 Mär. 2020
Bearbeitet: David Goodmanson am 21 Mär. 2020
Hi Dhruv.
your choice of a = 0.125 is kind of messing things up, because it's well above where the data ends. If you go only to the end of the data as in figure 2, the results are more sensible. Also,
spY = spline(v,r,XX);
is simpler than the two commands involving polyval.
a = .125;
sp = spline(v,r);
XX = linspace(0,a,100);
spY = ppval(sp, XX);
figure(1)
plot(v,r,'o',XX,spY);
grid on
a = max(v);
sp = spline(v,r);
XX = linspace(0,a,100);
spY = ppval(sp, XX);
figure(2)
plot(v,r,'o',XX,spY);
grid on

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by