Linear System With Symbolic And Numerical Constants

1 visualización (últimos 30 días)
Mike
Mike el 3 de Sept. de 2021
Respondida: Mike el 4 de Sept. de 2021
How do I solve the following system on MATLAB?
The solution should be Fx1 = -1 and Fx5 = 0. Also, u2 = 0.005, u3 = 0.01, and u4 = 0.015.

Respuesta aceptada

Mike
Mike el 4 de Sept. de 2021
I used:
syms f1 u2 u3 u4 f5
f=[f1;0;0;0;f5];
u=[0;u2;u3;u4;0.02];
k= [200 -200 0 0 0; -200 400 -200 0 0; 0 -200 400 -200 0; 0 0 -200 400 -200; 0 0 0 -200 200];
solve(f == k*u)
Yeilding:
f1: [1x1 sym]
f5: [1x1 sym]
u2: [1x1 sym]
u3: [1x1 sym]
u4: [1x1 sym]
To display the results use:
ans.f1
ans.f5
ans.u2
and so on.
Or:
syms f1 u2 u3 u4 f5
s=solve(0*0+0*u2+0*u3-200*u4+200*0.02==f5,0*0+0*u2-200*u3+400*u4-200*0.02==0,0*0-200*u2+400*u3-200*u4+0*0.02==0,-200*0+400*u2-200*u3+0*u4+0*0.02==0,200*0 -200*u2 + 0*u3 + 0*u4 +0.02*0==f1)

Más respuestas (1)

Walter Roberson
Walter Roberson el 4 de Sept. de 2021
Use syms and set up a solve(A\b == x)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by