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
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
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 Center 및 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!