Surface fit in polar coordinates

조회 수: 3 (최근 30일)
Alessio
Alessio 2018년 12월 18일
댓글: David Goodmanson 2018년 12월 21일
Hello,
I've looked elsewhere in the formum and although there are close topics I haven't quite found what I'm looking for.
I have a set of data matrices X,Y,Z. X,Y are a regular lattice of Cartesian coordinates, Z is a quantity of which I want to study the dependence on X and Y.
My data looks like in this example plot (contourf):
chi.png
I want to fit these data to an antisymmetric function of the type
or symilar function, so that I'm able to remove the antisymmetric part from the data and guess/find higher harmonic contribution in ϕ, for example.
I know some fitting methods in matlab, but what would you use to best solve this case and why?
Thanks in advance!
  댓글 수: 3
Alessio
Alessio 2018년 12월 20일
Thanks for your comment.
Since X and Y are the coordinates for a triangular lattice it may be a bit tricky to crop them to render them symmetric and apply your suggestion, but I'll try. I'm afraid though that whatever extra contribution I'm looking for might cancel out as well in this way.
Best
David Goodmanson
David Goodmanson 2018년 12월 21일
aha, I didn't realize you have a triangular lattice, which changes things

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

답변 (1개)

KSSV
KSSV 2018년 12월 19일
Read about cart2pol ......you can convert your X, Y into r and phi...using this. LAter you can substitute this r and phi, into your function.
  댓글 수: 1
Alessio
Alessio 2018년 12월 20일
Hi KSSV, thanks for your comment.
Actually this was my first approach:
Convert X,Y to polar:
phi = atan2(Y,X);
r = sqrt(X.^2+Y.^2);
then try to fit with a custom function:
f = @(a1,a2,pp,rr) a1 * cos(pp) * rr * exp(-a2*rr.^2);
[phiFit,rFit,zFit] = prepareSurfaceData(phi,r,z);
fz = fit( [phiFit, rFit], zFit, f, ...
'StartPoint', [0.0025, 0.01], ...
'Lower', [0, 0], ...
'Robust', 'LAR' )
I keep getting this error when trying to fit:
Error using fittype>iDeduceCoefficients (line 619)
The independent variable x does not appear in the equation expression.
Use x in the expression or indicate another variable as the independent variable.
I'm not sure how to specify the independent variable and I'm also not sure I'm doing everything correct.
Any feedback?
I've just stumpled upon THIS that uses nlinfit, I'll try to look also in that direction.
Best

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

카테고리

Help CenterFile Exchange에서 Bounding Regions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by