plot a fitted curve and specified axes
Mostrar comentarios más antiguos
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 comentarios
Alexander Richter
el 28 de En. de 2022
Iam stucked at the same issue, did not find a solution yet. Any updates on the problem? Thanks
Geoff Hayes
el 29 de En. de 2022
@Alexander Richter - are you using the same code or something different? Please provide details.
Wave
el 10 de Feb. de 2022
Respuestas (1)
Geoff Hayes
el 14 de Mayo de 2020
plot(fitdata, 'Parent', hAxes)
where hAxes is the handle to your axes.
4 comentarios
Wave
el 15 de Mayo de 2020
Geoff Hayes
el 15 de Mayo de 2020
What does the documentation for your version of MATLAB say about using plot and fit objects?
Marleen
el 9 de Feb. de 2022
Why is it possible to specify the parent axes (a Name Value pair) for sfit objects but not for cfit?

Geoff Hayes
el 10 de Feb. de 2022
@Marleen - you may want to ask this as a new question.
Categorías
Más información sobre Fit Postprocessing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!