필터 지우기
필터 지우기

Using fnplt in UIAxes

조회 수: 2 (최근 30일)
Biraj Khanal
Biraj Khanal 2022년 6월 1일
답변: Biraj Khanal 2022년 11월 17일
I learned that fnplt takes a function as an input.
fnplt(cscvn([1 0 -1 -1 0 1;0 1 0 0 -1 0]));
The line above works fine.However, I could not do that in the UIAxes.
fnplt(app.UIAxes,cscvn([1 0 -1 -1 0 1;0 1 0 0 -1 0]));
The line above would produce the following error:
Input is not a function.
Error in fnplt (line 72)
f = fn2fm(f);
What is my error here and how can I fix it?
  댓글 수: 1
Derek Vasquez
Derek Vasquez 2022년 8월 8일
This is not exactly a solution, but I found a workaround to a similar problem by using something like this
t = linspace(0,5,100);
traj = fnval(cscvn([1 0 -1 -1 0 1;0 1 0 0 -1 0]),t);
plot(app.UIAxes,traj(1,:),traj(2,:))
Hope this helps someone!

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

채택된 답변

Biraj Khanal
Biraj Khanal 2022년 11월 17일
cscvn constructs spline in a piecewise polynomial form. as Derek has written in his comment, I had to evaluate the spline with fnval at certain breaks before plotting them .
For example
x = [-10,-8,-4,0,4,6,10];
y = [1 8 10 11 10 9 1];
s = cscvn([x;y]);
s_breaks = s.breaks;
new_y = fnval(s,linspace(s.breaks(1),s.breaks(end),100));
plot(app.UIAxes,new_y(1,:),new_y(2,:));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by