Error using matlab.graphics.axis.Axes/set
15 ビュー (過去 30 日間)
古いコメントを表示
Hi, I am fitting experimental data to get a surface plot through curve fitting tool. However, there seems to be an error as shown below. The code generated from curve fitting tool is also provided for your reference. Thank you.
function [fitresult, gof] = createFit(m1, x, y11)
%CREATEFIT(M1,X,Y11)
% Create a fit.
%
% Data for 'untitled fit 1' fit:
% X Input : m1
% Y Input : x
% Z Output: y11
% 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 15-Aug-2016 21:58:49
%%Fit: 'untitled fit 1'.
[xData, yData, zData] = prepareSurfaceData( m1, x, y11 );
% Set up fittype and options.
ft = fittype( 'A1*y^A2*exp(A3*x*0.01)', 'independent', {'x', 'y'}, 'dependent', 'z' );
opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
opts.Display = 'Off';
opts.StartPoint = [0.964888535199277 0.157613081677548 0.970592781760616];
opts.Upper = [Inf Inf 0];
% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft, opts );
% Plot fit with data.
figure( 'Name', 'untitled fit 1' );
h = plot( fitresult, [xData, yData], zData );
legend( h, 'untitled fit 1', 'y11 vs. m1, x', 'Location', 'NorthEast' );
% Label axes
xlabel m1
ylabel x
zlabel y11
grid on
view( 124.4, 10.3 );
Error using matlab.graphics.axis.Axes/set While setting the 'XLim' property of 'Axes': Value must be a 1x2 vector of numeric type in which the second element is larger than the first and may be Inf
Error in sfit/plot>iParseInputs (line 269) set( hParent, 'XLim', xlim );
Error in sfit/plot (line 44) [XY, Z, in, out, style, level, hParent] = iParseInputs( obj, varargin{:} );
0 件のコメント
回答 (1 件)
Walter Roberson
2016 年 8 月 15 日
The third component of your start point is greater than the third component of your upper bound. That might lead to problems with mixing up upper and lower bound perhaps
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Fit Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!