problem fitting data to power law

조회 수: 2 (최근 30일)
Jeremy Diallo
Jeremy Diallo 2016년 3월 10일
댓글: Are Mjaavatten 2016년 3월 14일
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