curve fitting's generated code doesn't work

조회 수: 10 (최근 30일)
boaz taitler
boaz taitler 2017년 8월 10일
댓글: dpb 2017년 8월 10일
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
dpb
dpb 2017년 8월 10일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by