필터 지우기
필터 지우기

Error using matlab.gra​phics.axis​.Axes/set

조회 수: 31 (최근 30일)
Yogesh T L
Yogesh T L 2016년 8월 15일
편집: Walter Roberson 2016년 8월 16일
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{:} );

답변 (1개)

Walter Roberson
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
Yogesh T L
Yogesh T L 2016년 8월 16일
Thanks for your response Walter. I have tried to play with your answer by removing or changing the start points of third component but still the same error arises. The plot works well in curve fitting toolbox but not in the generated code. I don't understand the reason for this error.
Yogesh T L
Yogesh T L 2016년 8월 16일
편집: Walter Roberson 2016년 8월 16일
Initially when
X=[83.208;
83.208
83.208;
83.208;
83.208]
resulted in the above error. However, on changing one of the element in the X vector from 83.208 to 83.209, it gives a 3-D graph. I don't know the reason behind it but let me know if you could explain. Thank you.

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

카테고리

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