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일
편집: 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