When i am executing this code for individual elements of 'i', then there is no error but when I use a loop to iterate through same values of 'i', then "symengine" error occurs. Also "Error in sym/taylor". please help
조회 수: 1 (최근 30일)
이전 댓글 표시
syms E I L P x;
Saa = x*(x*cos(x) - sin(x))/(x*sin(x) + 2*cos(x) - 2);
Sab = x*(sin(x) - x)/(x*sin(x) + 2*cos(x) - 2);
for i = 2:4
Saav = taylor(Saa,x,'Order',i);
Sabv = taylor(Sab,x,'Order',i);
Saav = subs(Saav,L*sqrt(P/(E*I)));
Sabv = subs(Sabv,L*sqrt(P/(E*I)));
K11 = Saav; K12 = Sabv; K13 = (Saav+Sabv)/L; K14 = -K13;
K21 = Sabv; K22 = Saav; K23 = K13; K24 = K14;
K31 = K13; K32 = K13; K33 = (Saav + 2*Sabv + Saav)/(L^2) - (P/(E*I)); K34 = -K33;
K41 = -K31; K42 = -K32; K43 = -K33; K44 = -K34;
K = (E*I/L) * [K11 K12 K13 K14; K21 K22 K23 K24; K31 K32 K33 K34; K41 K42 K43 K44];
sol = eig(K);
for j = 1:4
eqn = sol(j) == 0;
solP = solve(eqn,P);
disp(solP)
end
fprintf("iteration complete \n");
end
Following errors are occuring in the code:
Error using symengine. Unable to compute a Taylor expansion.
Error in sym/taylor (line 128). tSym = mupadmex('symobj::taylor',f.s,x.s,a.s,options);
Error in exprojectcode (line 5). Saav = taylor(Saa,x,'Order',i);
댓글 수: 0
답변 (1개)
Abhishek Kumar
2020년 12월 11일
Hi Rahul, I understand you are getting error for Taylor Expansion and tried running your code. The code does generate error for order values less than 4, buf for order greater than that the code is executed correctly
syms E I L P x;
Saa = x*(x*cos(x) - sin(x))/(x*sin(x) + 2*cos(x) - 2);
Sab = x*(sin(x) - x)/(x*sin(x) + 2*cos(x) - 2);
for i = 4:8 %for i>4 the code runs without any error.
Saav = taylor(Saa,x,'Order',i);
Sabv = taylor(Sab,x,'Order',i);
Saav = subs(Saav,L*sqrt(P/(E*I)));
......
......
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!