plot a fitted curve and specified axes

1 次查看(过去 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 中查找有关 Fit Postprocessing 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by