Filter löschen
Filter löschen

plot a fitted curve and specified axes

1 Ansicht (letzte 30 Tage)
Wave
Wave am 14 Mai 2020
Kommentiert: Wave am 10 Feb. 2022
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 Kommentare
Geoff Hayes
Geoff Hayes am 29 Jan. 2022
@Alexander Richter - are you using the same code or something different? Please provide details.
Wave
Wave am 10 Feb. 2022
@Alexander Richter No updates from my side. Still using it without the specification of ax

Melden Sie sich an, um zu kommentieren.

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by