Problems with MLE method and curve fitting!
5 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!