Solving Normal Equations 3-Parameter Weibull Distribution
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I am new to Matlab and would like to know how to input and solve the following Normal equations
1 comentario
Torsten
el 17 de Mayo de 2022
What is the function F from which you derived the three equations as dF/dm=0, dF/dc=0 and dF/dg=0 ?
Respuestas (1)
Saarthak Gupta
el 28 de Dic. de 2023
Editada: Saarthak Gupta
el 28 de Dic. de 2023
Hi Danny,
Looks like you are trying to solve a system of nonlinear equations in the variables “m”, “c”, “g”.
This qualifies as a typical root-finding problem. MATLAB offers the “fsolve” function as part of the Optimization Toolbox for this purpose.
Refer to the following code:
% Define x and w vectors, to be used in paramfunc
x = randi(10,10,1);
w = randi(10,10,1);
% Parameterize paramfunc using anonymous function since the problem is defined in terms of p, and
% not x and w
fun = @(p)paramfunc(p,x,w);
p0 = [1,-0.0001,-10];
options = optimoptions('fsolve','Display','iter');
[p,fval] = fsolve(fun,p0,options);
% To verify if the solution is reliable, calculate the residual (sum of squares of fval) to see how close it is to zero.
% A small residual confirms that p is a solution.
sum(sum(fval.*fval))
% System of nonlinear equations to solve
function F = paramfunc(p,x,w)
m = p(1);
c = p(2);
g = p(3);
F = [sum(m.*log(x-g).^2 + log(x-g).*(c-w))
sum(c-w+m.*log(x-g))
sum((log(exp(1))./(x-g)).*(w-m.*log(x-g))-c)];
end
“fsolve” uses Levenberg-Marquardt and trust-region algorithms to find roots of the system of equations. Use one of these methods if the system may not have a zero. The algorithm still returns a point where the residual is small.
By default, “fsolve” chooses the trust-region dogleg algorithm, and its success in finding a solution will depend on the values in x, w, and the initial guess p0.
Refer to the following MATLAB documentation for further reference:
- fsolve: https://www.mathworks.com/help/optim/ug/fsolve.html
- Equation Solving Algorithms: https://www.mathworks.com/help/optim/ug/equation-solving-algorithms.html
0 comentarios
Ver también
Categorías
Más información sobre Systems of Nonlinear Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!