Issues with subs function
조회 수: 6 (최근 30일)
이전 댓글 표시
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
채택된 답변
Paul
2023년 4월 9일
편집: Paul
2023년 4월 9일
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


