Help with non linear equations.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mohammed Adjieteh
el 7 de Dic. de 2022
Comentada: Mohammed Adjieteh
el 8 de Dic. de 2022
Can someone please help me solve these equations?
I tried to use fsolver but the estimates are very bad. I expect \mu to be 8, \sigma = 4 and \alpha =2.
I will be very glad if someone helps me out on how to better my estimates and improve the results.
Thank you!
0 comentarios
Respuesta aceptada
Torsten
el 7 de Dic. de 2022
fun = @(x)[8.07-(x(1)-x(2)+x(2)*0.9^(-1/x(3)));11.82-(x(1)-x(2)+x(2)*0.5^(-1/x(3)));284.23-(x(1)-x(2)+x(2)*0.1^(-1/x(3)))];
x = fsolve(fun,[156 45 0.8])
fun(x)
Más respuestas (2)
Bora Eryilmaz
el 7 de Dic. de 2022
Editada: Bora Eryilmaz
el 7 de Dic. de 2022
fsolve actually finds a correct solution:
x = fsolve(@(x) fcn(x),[1;1;1])
You can see that the solution satisfies the equations (within a tolarance):
fcn(x)
Actually, your suggested values are not a solution for these equations:
fcn([8;4;2])
function F = fcn(x)
m = x(1);
s = x(2);
a = x(3);
F = [ ...
8.07 - m + s - s*(1-0.1)^(-1/a) ...
11.82 - m + s - s*(1-0.5)^(-1/a) ...
284.23 - m + s - s*(1-0.9)^(-1/a) ...
];
end
John D'Errico
el 7 de Dic. de 2022
Editada: John D'Errico
el 7 de Dic. de 2022
syms mu sigma alpha
eq(1) = 8.07 == mu - sigma + sigma*(1-0.1)^(-1/alpha)
eq(2) = 11.82 == mu - sigma + sigma*(1-0.5)^(-1/alpha)
eq(3) = 284.23 == mu - sigma + sigma*(1-0.9)^(-1/alpha)
First, make the problem simpler, subtract equations 1 and 2, then 1 and 3.
eqhat(1) = eq(3) - eq(2)
eqhat(2) = eq(3) - eq(1)
And replace alpha by a, where a = -1/alpha
syms a
eqhat = subs(eqhat,alpha,-1/a)
Next, factor out sigma from each equation. We can use that to eliminate sigma also.
sig1 = solve(eqhat(1),sigma)
eqa = subs(eqhat(2),sigma,sig1)
That yields one equation, involving only a. It seems to have only one solution, but no analytical solution seems to drop out.
a = vpasolve(eqa)
and therefore we have alpha.
-1/a
which gives us sigma. At this point, mu and sigma are linear parameters.
solve(subs(eq(1),alpha,-1/a),subs(eq(2),alpha,-1/a))
Direct enough. However, the solutions you expected are not even close to what comes out. Not my fault. The mathematics won't lie.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!