subs( ) command would not work

6 ビュー (過去 30 日間)
Kevin Brinneman
Kevin Brinneman 2018 年 4 月 27 日
コメント済み: Kevin Brinneman 2018 年 4 月 27 日
Hello everyone,
Real simple. At the end of the following code, I am trying to substitute my symbolic variables with actual numbers. The commando seems to work(does not give me an error) but once i print the matrices, it would not show the substituted variables. Check this out:
subs(A,a,0.09);subs(A,b,0.09);subs(A,c,100);subs(A,k,4.0);subs(A,x1,1);
subs(A,x2,0);subs(A,x3,1);subs(A,x4,40);subs(A,x5,0);subs(A,x6,1);
subs(A,x7,0);subs(A,u1,.08);subs(A,u2,.04);
subs(B,a,0.09);subs(B,b,0.09);subs(B,c,100);subs(B,k,4.0);subs(B,x1,1);
subs(B,x2,0);subs(B,x3,1);subs(B,x4,40);subs(B,x5,0);subs(B,x6,1);
subs(B,x7,0);subs(B,u1,.08);subs(B,u2,.04);
where A and B are matrices and those symbolic variables are in the matrix functions
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 27 日
The code here is a subset of https://www.mathworks.com/matlabcentral/answers/397685-subs-command-would-not-work but this one has an answer.

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

採用された回答

Sergey Kasyanov
Sergey Kasyanov 2018 年 4 月 27 日
Hello,
you should to reassign variable after substitution:
A=subs(A,a,1);
  1 件のコメント
Kevin Brinneman
Kevin Brinneman 2018 年 4 月 27 日
Thank you, it worked!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by