Fitting data to a polar equation
古いコメントを表示
I have some data that looks like this: 

I have it in Cartesian coordinates but can convert it to polar coordinates of course. Now I need to fit it to a somewhat messy function of the form shown in the code below using the Curve Fitting Toolbox. The problem is that the function is in polar coordinates, and I have no clue how to write the custom fitting function to work with this (i.e. in the form y = f(x))
Here the fitting parameters should be kappa, k00, k01, etc. Any idea how to do this? The parameters in teh code snipped below are tuned to look somewhat similar to my data, but I need a more accurate fit not done by eye.
A = @(theta, kappa, mu, nu) cos(nu*kappa)*cos(mu*theta);
theta = linspace(0, 2*pi, 500);
kappa = 5.0;
k00 = 1.0;
k01 = 2.0;
k02 = -5.0;
k03 = -1.7;
k31 = 0.0;
k60 = 0.7;
k120 = 0.1;
FS = k00*A(theta, kappa, 0, 0) + k01*A(theta, kappa, 0, 1) + k02*A(theta, kappa, 0, 2) ...
+ k03*A(theta, kappa, 0, 3) + k31*A(theta, kappa, 3, 1) + k60*A(theta, kappa, 6, 0)...
+ k120*A(theta, kappa, 12, 0);
polarplot(theta, FS);
3 件のコメント
Rik
2021 年 2 月 14 日
Can you attach your data in a mat file? That way people can try to fit to your actual data.
In the mean time: did you just put the function in the fit function, ignoring that the coordinates or function are in polar coordinates? It might not be optimal, but it should work.
Omar Ashour
2021 年 2 月 14 日
編集済み: Omar Ashour
2021 年 2 月 14 日
Omar Ashour
2021 年 2 月 14 日
編集済み: Omar Ashour
2021 年 2 月 14 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File 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!

