Borrar filtros
Borrar filtros

How to construct cubic splines?

1 visualización (últimos 30 días)
Momo
Momo el 24 de Feb. de 2018
Editada: Momo el 27 de Feb. de 2018
Hello, I am trying to implement the following code in Matlab but it dose not work.
x = 2*pi*[0 1 .1:.2:.9];
y = cos(x);
csp = csape( x, y, 'periodic' );
hold on
fnplt(csp,'g')
hold off

Respuesta aceptada

John D'Errico
John D'Errico el 24 de Feb. de 2018
Editada: John D'Errico el 24 de Feb. de 2018
Do you have the curve fitting toolbox? CSAPE is part of that TB. (It used to be in the splines TB but that got merged into the curve fitting TB some years ago.)
My SLM toolbox (found on the file exchange) does allow periodic boundary conditions.
x = 2*pi*[0:.1:1];
y = cos(x);
SLM = slmengine(x,y,'knots',x,'endcond','periodic','regul',0,'result','pp','plot','on');
So a purely interpolating cubic spline, with periodic boundary conditions.
  2 comentarios
John D'Errico
John D'Errico el 24 de Feb. de 2018
Editada: John D'Errico el 24 de Feb. de 2018
At the command line, use the ver command. If you have that TB, you will see it listed. So, for me, I see this:
ver
...
Curve Fitting Toolbox Version 3.5.6 (R2017b)
John D'Errico
John D'Errico el 25 de Feb. de 2018
Works fine for me. Don't you hate that? ;-)
x = 2*pi*[0 1 .1:.2:.9];
y = cos(x);
csp = csape( x, y, 'periodic' );
fnplt(csp,'g')
Your release is only slightly older than mine, which should not be a problem.
Perhaps you have hurt the feelings of your computer recently? Try giving it flowers? My computer can hold a grudge. Ok. Only kidding.
Seriously, can you use the other tools from the curve fitting toolbox? If not, then you might have an installation problem with that toolbox. I'd check to see if there were corruption problems on your disk. Maybe try re-installing MATLAB from online - that is pretty quick with a fast connection.
I just looked at the release notes, but do not see any recent changes to csape.
Is the CFT in your search path? So while you have a license, perhaps your search path got screwed up?

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by