Empty sym: 0-by-1

2 visualizzazioni (ultimi 30 giorni)
Nikos Gavalakis
Nikos Gavalakis il 17 Giu 2020
Commentato: Star Strider il 17 Giu 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

Risposta accettata

Star Strider
Star Strider il 17 Giu 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 Commenti
Nikos Gavalakis
Nikos Gavalakis il 17 Giu 2020
Thank you very much m8!! I'm going to solve matrices this way from now on.
Btw I might have done something else wrong because i wasnt expecting u2,v2,u3 to be such large numbers :(
Star Strider
Star Strider il 17 Giu 2020
As always, my pleasure!
Since the matrix is multiplied by 5E+7, the large numbers do not surpise me.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by