How to properly write a code for this system of nonlinear equations involving hyperbolic and trigonometric functions
3 views (last 30 days)
Show older comments

Hi! So I have the values for T1, T2, what im trying to solve are the values of gamma 1, gamma 2 and alpha0. I was able to write the following code but i believe the outputs are wrong:
T1 = 0.5780;
T2 = 0.1561;
syms y1 y2 alpha0
E1 = -T2/T1 + (y1/y2)*((y1^2+alpha0^2)/(y2^2+alpha0^2))^0.5;
E2 = 2+(2+(alpha0^4/(y2^2*(y2^2+alpha0^2))))*cos(y2)*cosh((y2^2+alpha0^2)^0.5)+((alpha0^2/(y2*(y2^2+alpha0^2)^0.5)))*sin(y2)*sinh((y2^2+alpha0^2)^0.5);
E3 = 2+(2+(alpha0^4/(y1^2*(y1^2+alpha0^2))))*cos(y1)*cosh((y1^2+alpha0^2)^0.5)+((alpha0^2/(y1*(y1^2+alpha0^2)^0.5)))*sin(y1)*sinh((y1^2+alpha0^2)^0.5);
eqs = [E1, E2, E3];
[y1,y2,alpha0] = vpasolve(eqs,[y1,y2,alpha0])
Any help is greatly appreciated. Thank you!
0 Comments
Answers (1)
Walter Roberson
on 1 Oct 2021
You are right, the solutions fail back-substitution
T1 = 0.5780;
T2 = 0.1561;
syms y1 y2 alpha0
E1 = -T2/T1 + (y1/y2)*((y1^2+alpha0^2)/(y2^2+alpha0^2))^0.5;
E2 = 2+(2+(alpha0^4/(y2^2*(y2^2+alpha0^2))))*cos(y2)*cosh((y2^2+alpha0^2)^0.5)+((alpha0^2/(y2*(y2^2+alpha0^2)^0.5)))*sin(y2)*sinh((y2^2+alpha0^2)^0.5);
E3 = 2+(2+(alpha0^4/(y1^2*(y1^2+alpha0^2))))*cos(y1)*cosh((y1^2+alpha0^2)^0.5)+((alpha0^2/(y1*(y1^2+alpha0^2)^0.5)))*sin(y1)*sinh((y1^2+alpha0^2)^0.5);
eqs = [E1, E2, E3];
[y1sol,y2sol,alpha0sol] = vpasolve(eqs,[y1,y2,alpha0])
string(eqs)
simplify(subs(eqs, {y1, y2, alpha0}, {y1sol, y2sol, alpha0sol}))
7 Comments
Alex Sha
on 5 Oct 2021
How about the results below:
y1: -1.90447748745904
y2: -4.93345791290994
alpha0: -4.02843940412624
Fevl:
-8.32667268468867E-16
-3.32534000335727E-12
1.13686837721616E-12
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
