Info
This question is closed. Reopen it to edit or answer.
How can I fit parameters for a given equation and a given set of data?
1 view (last 30 days)
Show older comments
I have this function:
and I measured theta(psi) and psi and I have many data series of these two quantities. theta-r and theta-s are constant and known. I don't know only alfa and n .
I would like to know if there is a way to find those two parameters ( alfa and n) that best fit my data series.
Thank you,
Ginevra
0 Comments
Answers (1)
Star Strider
on 4 Jun 2014
I can’t test this with your actual data, but I simulated them and verified that this runs:
Thtar = 3;
Thtas = 5;
% b(1) = alfa, b(2) = n
ThtaPsi = @(b,psi) Thtar + (Thtas-Thtar)./((1+(b(1).*abs(psi)).^b(2)).^(1-1/b(2)));
B = nlinfit(psi, Thta, ThtaPsi, [1 1])
fprintf(1,'\n\nEstimated Parameters:\n\t\talfa = %.6f\n\t\tn = %.6f\n\n', B)
I used the Statistics Toolbox nlinfit function to do the nonlinear fit. You can also use lsqcurvefit, and with one additional statement, fminsearch to estimate the parameters.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!