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!

