problem fitting data to power law

2 次查看(过去 30 天)
Hi,
I am trying to fit my data to a power law of the form "y =1 - (x/9.5)^n" where n is the parameter to adjust. The data im using for x and y are respectively:
pos_pitot = [-9.5 -8.5 -7.5 -6.5 -5.5 -4.5 -3.5 -2.5 -1.5 -0.5 0.5 1.5 2.5 3.5 4.5 5.5 6.5];
v_sur_vaxe = [0.5611 0.7454 0.8165 0.8498 0.8924 0.9428 0.9718 0.9813 1.0000 1.0000 0.9907 0.9907 0.9718 0.9428 0.9129 0.8819 0.8389];
I tried this code :
fit_curve = fit(pos_pitot', v_sur_vaxe','power2');
r_fit = r/9.5;
plot(r_fit,fit_curve);
I am not even sure this is the right thing to do. Could somebody please help me and provide me a working solution to do this simple adjustement ? This is the first time I am trying to do something like that...
Thanks a lot.
  2 个评论
Star Strider
Star Strider 2016-3-10
I tried to fit your function ‘y = 1 - (x/9.5)^n’ with fminsearch and found that your function produces complex results. You have to sort that before you can fit it successfully.
Are Mjaavatten
Are Mjaavatten 2016-3-14
Try
plot(v_sur_vaxe,pos_pitot)
This will show you that the the reletionship is not single-valued. pos_pitot seems to depend on another variable in addition to v_sur_vaxe. Have another look at your original problem and see if you can find such a variable. Could both your variables be functions of that one third variable?

请先登录,再进行评论。

回答(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