subs(a,b,1) introduces variable b into a?

Hi,
This is a peculiar issue. I am using sym variables. My variable system_matrix has no dependence on the sym variable l, but when I run the line:
system_matrix = subs(system_matrix,l,10)
system_matrix all of a sudden has l introduced! if I run the same line again, it gets rid of it.
Code: -----------------
syms m b k1 k2 l rho U C
syms s
M = eye(2); K_H = [(k1+k2)/(m*b),((k1-k2)/(2*m))-C*rho*U^2/(2*m);6*(k1-k2)/(m*b^2),3*(k1+k2)/(m*b)-3*C*rho*U^2/(2*m*b)];
system_matrix = s^2.*M + K_H;
% substitute for values
system_matrix = subs(system_matrix,m,15);
system_matrix = subs(system_matrix,k1,5000);
system_matrix = subs(system_matrix,k2,4000);
system_matrix = subs(system_matrix,b,1);
system_matrix = subs(system_matrix,l,10); % for some reason this introduces new l's into the equation?
system_matrix = subs(system_matrix,C,1);
system_matrix = subs(system_matrix,rho,1.25);
----------------
end code
At the end of this expression, system_matrix has the variable l in it, even though it never did before!
Anyone know what is going on?

回答 (1 件)

Stefan Wehmeier
Stefan Wehmeier 2014 年 10 月 30 日

0 投票

I cannot reproduce this. If it happens (in which version ??), then it is clearly unexpected.

1 件のコメント

Raman
Raman 2014 年 12 月 22 日
編集済み: Raman 2014 年 12 月 22 日
THis happens in 2012b. I simplified it to this:
syms m l;
system_matrix = [1,m/(10);1,1];
system_matrix = subs(system_matrix,l,10);
It appears that the function is replacing all instances of 10 with "l" instead of the other way.
I tried the same code in 2014a and it seems to be fixed.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2014 年 10 月 7 日

編集済み:

2014 年 12 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by