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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Abhishek Kumar
am 11 Dez. 2020
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 Kommentare
Siehe auch
Kategorien
Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!