solving nonlinear equations

3 visualizaciones (últimos 30 días)
Raphael
Raphael el 25 de Abr. de 2012
Hello,
i tried to work on solving the following equations, so that the code returns values for w and theta. However this does not work in the desired way. I even tried to work with fminsearch. Does somebody know how to solve this problem?
syms w theta;
eq1 = '-0.0889=(-w^0.5*(w-1)^2*(w*(w+2)*sinh(3*theta)+3*sinh(theta)))/(sqrt(2)*(w-1)*(w*cosh(2*theta)+1)^1.5)';
eq2 = '7.2191 =(w^2*((w^4+2*w^+3*w^2-3)*cosh(4*theta)+4*(w+2)*cosh(2*theta))+3*(2*w+1))/(2*(w*cosh(2*theta)+1)^2)';
[w theta]=solve(eq1,eq2,w,theta)
thank you for your help.

Respuesta aceptada

Alexander
Alexander el 25 de Abr. de 2012
I do get the following error message:
Error using solve>processString (line 337)
' -0.0889=(-w^0.5*(w-1)^2*(w*(w+2)*sinh(3*theta)+3*sinh(theta)))/(sqrt(2)*(w-1)*(w*cosh(2*theta)+1)^1.5) ' is not a valid expression or equation.
There seems to be a problem with theta. Since theta also is a MuPAD function, the symbolic engines confuses the input. If you have MATLAB 12a or later, you should try to avoid the string syntax (note, that you need double '==' for the comparison):
syms w theta;
eq1 = -0.0889==(-w^0.5*(w-1)^2*(w*(w+2)*sinh(3*theta)+3*sinh(theta)))/(sqrt(2)*(w-1)*(w*cosh(2*theta)+1)^1.5);
eq2 = 7.2191 ==(w^2*((w^4+2*w^+3*w^2-3)*cosh(4*theta)+4*(w+2)*cosh(2*theta))+3*(2*w+1))/(2*(w*cosh(2*theta)+1)^2);
[w theta]=solve(eq1,eq2,w,theta)
This gives:
w =
0.039410543092148572708570152224833
Theta =
1.5385135630436219217489780415314
If yo have an older version of MATLAB, try replacing theta by another variable. I tried Theta, with a capital T:
syms w Theta;
eq1 = '-0.0889=(-w^0.5*(w-1)^2*(w*(w+2)*sinh(3*Theta)+3*sinh(Theta)))/(sqrt(2)*(w-1)*(w*cosh(2*Theta)+1)^1.5)';
eq2 = '7.2191 =(w^2*((w^4+2*w^+3*w^2-3)*cosh(4*Theta)+4*(w+2)*cosh(2*Theta))+3*(2*w+1))/(2*(w*cosh(2*Theta)+1)^2)';
[w Theta]=solve(eq1,eq2,w,Theta)

Más respuestas (1)

Sean de Wolski
Sean de Wolski el 25 de Abr. de 2012
The expressions do nto need to be strings:
syms w theta;
eq1 = 0.0889+(-w^0.5*(w-1)^2*(w*(w+2)*sinh(3*theta)+3*sinh(theta)))/(sqrt(2)*(w-1)*(w*cosh(2*theta)+1)^1.5); %=0
eq2 = -7.2191 +(w^2*((w^4+2*w^+3*w^2-3)*cosh(4*theta)+4*(w+2)*cosh(2*theta))+3*(2*w+1))/(2*(w*cosh(2*theta)+1)^2); %=0
[w theta]=solve(eq1,eq2,w,theta)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by