필터 지우기
필터 지우기

How to construct cubic splines?

조회 수: 1 (최근 30일)
Momo
Momo 2018년 2월 24일
편집: Momo 2018년 2월 27일
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

채택된 답변

John D'Errico
John D'Errico 2018년 2월 24일
편집: John D'Errico 2018년 2월 24일
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
John D'Errico
John D'Errico 2018년 2월 24일
편집: John D'Errico 2018년 2월 24일
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 2018년 2월 25일
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?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by