필터 지우기
필터 지우기

I can not open box in workspace

조회 수: 1 (최근 30일)
Abdulaziz
Abdulaziz 2013년 11월 8일
댓글: Abdulaziz 2013년 11월 17일
Dear all
I have the next code which I found in curve fitting in matlab. The code displays the m and c from a file in workspace called ans and sse in file called gof . I do not know how to open this files. please is there any method to save m,c and sse in matrix.
You can run the next code to see the solution and files in work space.
function [fitresult, gof] = createFit(x, y)
%CREATEFIT(X,Y)
% Create a fit.
%
% Data for 'examle 13.2' fit:
% X Input : x
% Y Output: y
% Output:
% fitresult : a fit object representing the fit.
% gof : structure with goodness-of fit info.
%
% See also FIT, CFIT, SFIT.
% Auto-generated by MATLAB on 03-Nov-2013 14:30:04
%%Fit: 'examle 13.2'.
clear all
%clc
x=[0;0.0100000000000000;0.0200000000000000;0.0300000000000000;0.0400000000000000;0.0500000000000000;0.0600000000000000;0.0700000000000000;0.0800000000000000;0.0900000000];
y=[0.900000000000000;0.950000000000000;1;1.05000000000000;1.12000000000000;1.19000000000000;1.27000000000000;1.35000000000000;1.48000000000000;1.64000000000000];
[xData, yData] = prepareCurveData( x, y );
% Set up fittype and options.
ft = fittype( '((.9)^(1-m/2)+(1-m/2)*c*(pi)^(m/2)*x)^(2/(2-m))', 'independent', 'x', 'dependent', 'y' );
opts = fitoptions( ft );
opts.Algorithm = 'Levenberg-Marquardt';
opts.Display = 'off';
opts.Lower = [-Inf -Inf];
opts.StartPoint = [0.574061870053921 0.842825235947153];
opts.Upper = [Inf Inf];
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( 'Name', 'examle 13.2' );
h = plot( fitresult, xData, yData );
legend( h, 'y vs. x', 'examle 13.2', 'Location', 'NorthEast' );
% Label axes
xlabel( 'x' );
ylabel( 'y' );
grid off
I appreciate you help.

채택된 답변

Walter Roberson
Walter Roberson 2013년 11월 8일
coeffnames(fitresult)
coeffvalues(fitresult)
gof will not be a file: it will be a structure.
gof.sse
will show you the sse.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fit Postprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by