problem fitting data to power law

2 visualizzazioni (ultimi 30 giorni)
Jeremy Diallo
Jeremy Diallo il 10 Mar 2016
Commentato: Are Mjaavatten il 14 Mar 2016
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 Commenti
Star Strider
Star Strider il 10 Mar 2016
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 il 14 Mar 2016
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?

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by