plot a fitted curve and specified axes

조회 수: 5 (최근 30일)
Wave
Wave 2020년 5월 14일
댓글: Wave 2022년 2월 10일
Heyhey,
I have a problem with the follwing lines
fit_func = fittype("poly1");
fitdata = fit(XValues,YValues,fit_func);
h=plot(ax,fitdata);
-> so I got the error
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
If I use this line instead:
h=plot(fitdata);
Everything is fine
So my question: how am I able to use plot to creates the line in the axes specified by ax?
  댓글 수: 3
Geoff Hayes
Geoff Hayes 2022년 1월 29일
@Alexander Richter - are you using the same code or something different? Please provide details.
Wave
Wave 2022년 2월 10일
@Alexander Richter No updates from my side. Still using it without the specification of ax

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

답변 (1개)

Geoff Hayes
Geoff Hayes 2020년 5월 14일
Wave - from plot cfit or sfit object, try doing
plot(fitdata, 'Parent', hAxes)
where hAxes is the handle to your axes.
  댓글 수: 4
Marleen
Marleen 2022년 2월 9일
Why is it possible to specify the parent axes (a Name Value pair) for sfit objects but not for cfit?
Geoff Hayes
Geoff Hayes 2022년 2월 10일
@Marleen - you may want to ask this as a new question.

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

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by