Empty sym: 0-by-1
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nikos Gavalakis
le 17 Juin 2020
Commenté : Star Strider
le 17 Juin 2020
Hello, I'm new to matlab so any help would be appreciated! I needed matlab to solve some equation systems for my finite element class.
The method I used to use worked until this 4x4 system. I'm not sure what's the best way to solve this and with my way i get "Empty sym: 0-by-1" as an answer.
(the "P(u3)" is just a symbol, not a multiplication. P(u3)=p....and also E*A/L=5*10^7)

syms u2 v2 u3 p
e1= (5*10^7)*(2/4*u2 - 1/4*u3 + 3/4*u3)==0;
e2= (5*10^7)*(6/4*v2+sqrt(3)/4*u3-3*sqrt(3)/4*u3)==19613;
e3= (5*10^7)*(-1/4*u2+sqrt(3)/4*v2+1/4*u3-3/4*u3)==p;
e4= (5*10^7)*(sqrt(3)/4*u2-3/4*v2-sqrt(3)/4*u3+3*sqrt(3)/4*u3)==sqrt(3)*p;
result = solve(e1,e2,e3,e4)
result =
struct with fields:
p: [0×1 sym]
u2: [0×1 sym]
u3: [0×1 sym]
v2: [0×1 sym]
vpa(result.p)
ans =
Empty sym: 0-by-1
0 commentaires
Réponse acceptée
Star Strider
le 17 Juin 2020
Your error was in not leaving it in the original matrix form.
This works, however I am confused by your notation, so this may need to be corrected:
syms u2 v2 u3 p
Mtx = 5E+7 * [2/4 0 -1/4 +3/4;
0 6/4 sqrt(3)/4 -3*sqrt(3)/4;
-1/4 +sqrt(3)/4 +1/4 -3/4;
sqrt(3)/4 -3/4 -sqrt(3)/4 +3*sqrt(3)/4];
Vct = [0; 19613; p; sqrt(3)*p];
V = [u2; v2; u3; p];
S = vpasolve(Mtx * V == Vct);
Sp = S.p
Su2 = S.u2
Su3 = S.u3
Sv2 = S.v2
producing:
Sp =
-5661.785414808065059658960697873
Su2 =
17115934194006.985529996788305132
Su3 =
34231868371028.614815569381431287
Sv2 =
-9881889214341.853390449609171597
.
2 commentaires
Star Strider
le 17 Juin 2020
As always, my pleasure!
Since the matrix is multiplied by 5E+7, the large numbers do not surpise me.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Conversion Between Symbolic and Numeric dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!