简体   繁体   中英

fitting curve with nonlinear function in matlab

I've a problem using matlab. I need to fit a dataset with a nonlinear function like:

f=alfa*(1+beta*(zeta))^(1/3)

where alfa and beta are the coefficients to be found. I want to use the least squares method. How can I do this with the command lsqcurvefit ? Otherwise, there are other ways to solve my problem? Thank so much. Here there is the dataset:

zeta    val
0.001141174 1.914017718
0.010606563 1.36090774
0.021610291 1.906194276
0.070026172 1.87606762
0.071438139 1.877264055
0.081679327 1.859341737
0.101181292 2.518896436
0.107877774 2.772125094
0.205038829 3.032759627
0.211802706 1.483644094
0.561521724 2.424261001
0.61500615  2.559041397
0.647249191 2.949944577
0.943396226 2.84068921
1.091107474 3.453699422
1.175260761 2.604008404
1.837813003 4.00262983
2.057613169 4.565849247
2.083333333 3.779001445
3.188521323 4.430824069
4.085801839 7.766971568
4.22832981  5.711800741
4.872107186 4.949950059
9.756097561 10.78574156

you have to use the fit -function with fitType=Power2

fitobject = fit(zeta2,val,'Power2')

you can also use the cftool to manually determine your coefficients, especially if you want to keep the (1/3) . Maybe Least-Squares is not the best solution for your data, as woodchips said.

be aware that you have to substitute your zeta :

zeta2 = 1+beta*(zeta)

you can determine the coefficients as follows:

coeffvalues(fitobject)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM