How to properly write a code for this system of nonlinear equations involving hyperbolic and trigonometric functions

3 次查看(过去 30 天)
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!

回答(1 个)

Walter Roberson
Walter Roberson 2021-10-1
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])
y1sol = 
y2sol = 
alpha0sol = 
string(eqs)
ans = 1×3 string array
"(y1*((alpha0^2 + y1^2)/(alpha0^2 + y2^2))^(1/2))/y2 - 1561/5780" "cosh((alpha0^2 + y2^2)^(1/2))*cos(y2)*(alpha0^4/(y2^2*(alpha0^2 + y2^2)) + 2) + (alpha0^2*sinh((alpha0^2 + y2^2)^(1/2))*sin(y2))/(y2*(alpha0^2 + y2^2)^(1/2)) + 2" "cosh((alpha0^2 + y1^2)^(1/2))*cos(y1)*(alpha0^4/(y1^2*(alpha0^2 + y1^2)) + 2) + (alpha0^2*sinh((alpha0^2 + y1^2)^(1/2))*sin(y1))/(y1*(alpha0^2 + y1^2)^(1/2)) + 2"
simplify(subs(eqs, {y1, y2, alpha0}, {y1sol, y2sol, alpha0sol}))
ans = 
  7 个评论
Alex Sha
Alex Sha 2021-10-5
How about the results below:
y1: -1.90447748745904
y2: -4.93345791290994
alpha0: -4.02843940412624
Fevl:
-8.32667268468867E-16
-3.32534000335727E-12
1.13686837721616E-12
John Harvie delos Reyes
编辑:John Harvie delos Reyes 2021-10-5
Hello, Alex!
Solution found indeed satisfies the problem mathematically but I have to check for the negative values since alpha corresponds to a physical quantity in structural dynamics and y1 and y2 are eigenvalues which when found negative translates to an unstable stiffness matrix (again related to structural dynamics).
Im trying to solve this problem using fsolve currently. May I know the process you took to arrive to those values?
Thank you very much!
Edit:
apparently, postive values of the solutions you found also satisfies the problem
a0 =
4.0241
y1 =
1.9046
y2 =
4.9332
Check:
E1 =
0
E2 =
-8.5265e-14
E3 =
0
Im suspecting the function is very sensitive and could grow exponentially out of control. In any case, did you use some algorithm to arrive at a local maxima/minima?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Equation Solving 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by