curve fitting's generated code doesn't work
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
whenever i use the cftool, i can see the curve inside the cftool's app, afterward i try to use the generate code feature but when i run it from the script, the generated curve doesn't appear.
any idea why?
generated code for example that doesn't show the curve when i run the script:
%%Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( freq, y_high );
% Set up fittype and options.
ft = fittype( 'poly1' );
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft );
% Plot fit with data.
figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, xData, yData );
legend( h, 'y_high vs. freq', 'untitled fit 1', 'Location', 'NorthEast' );
% Label axes
xlabel freq
ylabel y_high
grid on
and also an attached image of the cftool showing that there is a line there.
1 Kommentar
dpb
am 10 Aug. 2017
Are there other existing figures? Perhaps you've executed a 'hold on' on existing figure or somesuch and it's plotting into it?
What does appear and are there any error messages or such?
If the axes appears, what are the ranges on the x- and y-axes? Do those match the range of the data on the tool plot?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!