Fit function doesn't fit custom arctan function

조회 수: 3 (최근 30일)
Moritz
Moritz 2014년 10월 30일
댓글: Siddharth Sundar 2014년 10월 31일
Hi everyone,
I have come across a rather weird issue, which may be very simple but I cannot figure it out myself. Basically I'm attempting to use the 'fit' function to fit a function to a surface. The function plots a surface with a rectangular hole using arctan. I define the fittype as below:
myfittype = fittype('(-a*atan(x-b)+a*atan(x-c)).*(-a*atan(y-b)+a*atan(y-c))',...
'independent',{'x', 'y'},'dependent','z')
This also works. Now I'm attempting fitting this to my surface using:
[f, gof] = fit( [x, y], z, myfittype)
This executes but the estimated coefficients (a, b, c) aren't of any use and not even close to the surface.
Hence, my question: did I misunderstand something? Am I doing something horrible wrong?
Thanks to everyone who read my post.
  댓글 수: 1
Siddharth Sundar
Siddharth Sundar 2014년 10월 31일
So the z variable contains the data to fit right? Is there a reason you are using the custom fittype that you use? The model you are using could be a reason that the fit isn't as good as you expected it to be.

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

답변 (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