How to plot a fit object without extrapolation?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Katharina
am 30 Sep. 2014
Kommentiert: Sean de Wolski
am 1 Okt. 2014
Hi, I am looking for a way to plot a curve fit object but without the extrapolation at the beginning and the end of the curve. My code for the current graph is as follows:
% Fit
[Fit.(string).fitresult, Fit.(string).gof] = fit( xData1, yData1, ft, 'Normalize', 'on' );
hc(k) = plot(xData1, yData1, '.', 'Marker', markerlist(k),'MarkerEdgeColor',colorlist(k,:),'MarkerFaceColor',colorlist(k,:));
hold on
% Plot fit
ha = plot(Fit.(string).fitresult);
Which generates this figure:

Since the end line, especially for the red curve, is not right, I need to remove that part. Does anyone have a solution? Thanks in advance! Best regards, Katharina
0 Kommentare
Akzeptierte Antwort
Sean de Wolski
am 30 Sep. 2014
You can pass 'XLim' into fitresult's plot to plot only over a specific range in x.
2 Kommentare
Sean de Wolski
am 1 Okt. 2014
Sorry, you're right and that certainly looks like a good enhancement request for cfits.
It looks like you'll have to evaluate it at the query points explicitly and then plot the x/y vectors.
For example:
x = 1:8;
y = fitresult(x); % evaluate at x
plot(x,y) % plot the vectors
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Fit Postprocessing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!