Help with non linear equations.

1 visualización (últimos 30 días)
Mohammed Adjieteh
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!

Respuesta aceptada

Torsten
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])
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x = 1×3
7.8119 0.8515 0.3980
fun(x)
ans = 3×1
0 0 0

Más respuestas (2)

Bora Eryilmaz
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])
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x = 3×1
7.8119 0.8515 0.3980
You can see that the solution satisfies the equations (within a tolarance):
fcn(x)
ans = 1×3
1.0e-13 * 0.0022 0.0089 0.5684
Actually, your suggested values are not a solution for these equations:
fcn([8;4;2])
ans = 1×3
-0.1464 2.1631 267.5809
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
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 = 
eq(2) = 11.82 == mu - sigma + sigma*(1-0.5)^(-1/alpha)
eq = 
eq(3) = 284.23 == mu - sigma + sigma*(1-0.9)^(-1/alpha)
eq = 
First, make the problem simpler, subtract equations 1 and 2, then 1 and 3.
eqhat(1) = eq(3) - eq(2)
eqhat = 
eqhat(2) = eq(3) - eq(1)
eqhat = 
And replace alpha by a, where a = -1/alpha
syms a
eqhat = subs(eqhat,alpha,-1/a)
eqhat = 
Next, factor out sigma from each equation. We can use that to eliminate sigma also.
sig1 = solve(eqhat(1),sigma)
sig1 = 
eqa = subs(eqhat(2),sigma,sig1)
eqa = 
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)
a = 
and therefore we have alpha.
-1/a
ans = 
0.39797912021003886009252959228167
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))
ans = struct with fields:
mu: 7.811904694538537823283206754899 sigma: 0.85154515981572698988870615312211
Direct enough. However, the solutions you expected are not even close to what comes out. Not my fault. The mathematics won't lie.

Categorías

Más información sobre Mathematics 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!

Translated by