Is there a way to substitute a set of variables to become a new variable?

1 visualización (últimos 30 días)
AppleNg
AppleNg el 6 de Ag. de 2022
Comentada: dpb el 6 de Ag. de 2022
Hi experts. I really need help here. I want to substitute R = P*a*b/2*k in my Equation_1 and Equation_2. However, the subs function only can change as single variable. I dont know how to do this. Thank you!
This is my script:
alpha_1 = 2*v1/l
alpha_2 = 2*v2/l
L1 = 0.5*P*V^2*a*b*l*alpha_1
L2 = 0.5*P*V^2*a*b*l*alpha_2
Equation_1 = (k*(v1-v2)*(l/2)) == (L1*l/4)
Equation_2 = (k*(2*v2-v1)*(l/2)) == (L2*l/4)
here I want to do the substitution as R = R = P*a*b/2*k in my Equation_1 and Equation_2
  5 comentarios
AppleNg
AppleNg el 6 de Ag. de 2022
Sorry sir. Thanks for helping me again
This is the script:
syms P V a b l alpha v1 v2 k R
alpha_1 = 2*v1/l
alpha_2 = 2*v2/l
L1 = 0.5*P*V^2*a*b*l*alpha_1
L2 = 0.5*P*V^2*a*b*l*alpha_2
% Take moment at the support reaction
R = (P*a*b)/(2*k)
Equation_1 = (k*(v1-v2)*(l/2)) == (L1*l/4)
Equation_2 = (k*(2*v2-v1)*(l/2)) == (L2*l/4)
dpb
dpb el 6 de Ag. de 2022
Doesn't show the problem -- but you didn't use R after you defined it so it has no bearing/effect...
It dawned on me later this is trying to do something with the symbolic TB -- I don't have it and have no experience trying to use it -- I was thinking only about numerical solution to the system.
If that's the end result wanted, then backslash should get you there; if you really need something symbolic somebody else will have to help; I simply don't know enough about it to even comment further.

Iniciar sesión para comentar.

Respuestas (1)

Torsten
Torsten el 6 de Ag. de 2022
Editada: Torsten el 6 de Ag. de 2022
syms a b alpha_1 alpha_2 v1 v2 l P V k R
alpha_1 = 2*v1/l;
alpha_2 = 2*v2/l;
R = P*a*b/(2*k);
L1 = R*V^2*l*alpha_1*k;
L2 = R*V^2*l*alpha_2*k;
Equation_1 = (k*(v1-v2)*(l/2)) == (L1*l/4);
Equation_2 = (k*(2*v2-v1)*(l/2)) == (L2*l/4);

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by