question about multi variable data fitting

Hi,
I am trying to do a simple two variable data fitting, using fittype:
g=fittype('a*exp(-(x-b)^2/c^2-(y-d)^2/f^2)','independent', {'x' 'y'});
However, everytime I run the program, error message says:
Error using internal.matlab.Message In 'curvefit:fittype:SameNameIndAndDepenVars', parameter {1} must be a scalar.
Error in message (line 11) msgObj = internal.matlab.Message(msgID,varargin{:});
Error in fittype>iTestCustomModelParameters (line 811) error(message('curvefit:fittype:SameNameIndAndDepenVars', obj.indep));
Error in fittype (line 355) iTestCustomModelParameters( obj );
Error in LED_roll (line 13) g=fittype('a*exp(-(x-b)^2/c^2-(y-d)^2/f^2)','independent', {'x' 'y'});
Please let me know where I did wrong here.
Thanks

 채택된 답변

Matt Fig
Matt Fig 2012년 10월 5일
편집: Matt Fig 2012년 10월 5일

0 개 추천

Give this a try:
g=fittype('a*exp(-(x-b).^2/c.^2-(y-d).^2./f^2)','inde',{'x' 'y'},'dep','z');
or, use a function handle:
g=fittype(@(a,b,c,d,f,x,y) a*exp(-(x-b).^2/c.^2-(y-d).^2./f^2),'ind', {'x' 'y'},'dep','z');

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품

질문:

Y
Y
2012년 10월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by