Problems with MLE method and curve fitting!

조회 수: 6 (최근 30일)
Chiara Tescione
Chiara Tescione 2021년 1월 16일
답변: Rishabh Mishra 2021년 1월 22일
Hi everyone, I hope someone can help me!
How can I estimate the parameters of a function (using an anonymous function) with the maximum likelihood method? I've seen several things on the internet (like mle, fminsearch) but nobody gives me the parameter values!
Example I have:
eq = fittype (@ (a, b, c, x) a * x. ^ 2 + b * x + c);
how do i get the values ​​of a, b and c with the MLE method?
Thanks a lot to everyone!

답변 (1개)

Rishabh Mishra
Rishabh Mishra 2021년 1월 22일
Hi,
Based on my understanding, you can use 'polyfitn' function to estimate the parameters a, b, c. For this purpose, you require a set of values of 'x' as double array and the corresponding values of function (a*x.^2 + b*x + c) stored in another double array say 'y'. Use the code below to estimate the co-efficient values for the function (a*x.^2 + b*x + c).
% assuming 'x' & 'y' are double arrays
% 'y' stores the function value corresponding to each element of 'x'
% 'n' stores degree of the function
n = 2;
p = polyfitn(x,y,n);
The values p.Coefficients(1), p.Coefficients(2) & p.Coefficients(3) correspond to estimated values of coefficients a, b & c respectively.
Hope this helps.

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by