Solving Normal Equations 3-Parameter Weibull Distribution
조회 수: 4 (최근 30일)
이전 댓글 표시
Hello, I am new to Matlab and would like to know how to input and solve the following Normal equations
댓글 수: 1
Torsten
2022년 5월 17일
What is the function F from which you derived the three equations as dF/dm=0, dF/dc=0 and dF/dg=0 ?
답변 (1개)
Saarthak Gupta
2023년 12월 28일
편집: Saarthak Gupta
2023년 12월 28일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!