Cubic Spline Interpolation and Plotting??? Question inside
Mostrar comentarios más antiguos
Use cubic splines to fit the data bellow. Repeat the calculation but now set the derivatives at the end points to zero. Compare the two profiles.
x=[0 2 4 7 10 12]; y=[20 20 12 7 6 6];
pp=spline(x,y)
This is the code I have so far but I keep getting an error when trying to plot it. I tried plotting using this code:
plot(x,pp,y) and again with plot(pp,x,y) and plot(x,y,pp)
the output I get for pp is:
form: 'pp'
breaks: [0 2 4 7 10 12]
coefs: [5x4 double]
pieces: 5
order: 4
dim: 1
But I keep getting error messages. I tried following the examples in the doc but it isn't working.
3 comentarios
Steven Lord
el 25 de Sept. de 2015
This sounds an awful lot like a homework problem. If it is, you need to show what you've tried and ask a SPECIFIC question in order to receive some guidance.
Nicole Bonino
el 25 de Sept. de 2015
You're using the form of the function which takes only two input arguments, which returns the coefficients for the spline functions. You can't plot coefficients, you need to plot function values.
Respuestas (1)
WAT
el 25 de Sept. de 2015
0 votos
Pay attention to the examples.
Categorías
Más información sobre Spline Postprocessing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!