Spline and PPL discrete points

5 views (last 30 days)
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.

Accepted Answer

David Goodmanson
David Goodmanson on 21 Mar 2020
Edited: David Goodmanson on 21 Mar 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

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!