Issues with subs function
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I'm doing some stuff with structural analysis and I need to substitute a symbolic variable in a symbolic funtion, but it seems that matlab substitutes all the variables when i need just to change one of them, then, the resulting expression must have one of the variables, but that does not happen ¿Could someone help me please?
l1=3;
h1=1.45;
b1=sqrt(l1^2+h1^2);
z=atand(h1/l1);
q1 = 0;
syms r1v x
R2v(r1v) =r1v/3 - 209/1395;
Mz1v(r1v,x) = -r1v + (R2v(r1v) * cosd(z)) * x + (q1 * sind(z)) * x
subs(Mz1v,x,b1)
The expected ouput should have an expression in terms of r1v because i'm just changing the value of x but it does not happen
0 commentaires
Réponse acceptée
Paul
le 9 Avr 2023
Modifié(e) : Paul
le 9 Avr 2023
I'm sure if you go through it step-by-step, or w/o assigning numbers until the end, you'll see that value of b1 is magical and all of the terms in r1v go away
l1=3;
h1=1.45;
syms l1 h1 real
b1=sqrt(l1^2+h1^2);
z=atand(h1/l1);
q1 = 0;
syms r1v x
R2v(r1v) =r1v/3 - 209/1395;
Mz1v(r1v,x) = -r1v + (R2v(r1v) * cosd(z)) * x + (q1 * sind(z)) * x
Mz1v = simplify(Mz1v)
Mz1v(r1v,b1)
If l1 = 3, as in this case, then the r1v is annihilated, and we're left with
subs(ans,l1,3)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Assumptions 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!


