フィルターのクリア

Usings subs on matrices ?

2 ビュー (過去 30 日間)
Matthieu
Matthieu 2013 年 10 月 31 日
コメント済み: Matthieu 2013 年 10 月 31 日
Hi everyone,
I'm trying to substitute variables in a matrix, but I run in something a little bit weird. When using the command "C = subs(C, exp1, exp2)", the result is not the matrix that I would have had if I had done the same substitution for all elements of C. How can it be ?
  2 件のコメント
Jos (10584)
Jos (10584) 2013 年 10 月 31 日
編集済み: Jos (10584) 2013 年 10 月 31 日
Your question is too vague. Can you give a very small example of
  1. your input
  2. what you did
  3. what you got as output
  4. what you expected to get
Added: I do not know a command called SUBS
Matthieu
Matthieu 2013 年 10 月 31 日
Hi Jos,
So my matrix C was 5x5 matrix with quite complicated expression, but to make it simple let's say that all coefficients are of the form : (xi - xj) * lp * exp where exp is a symbolic expression, xi (i=1:5) and lp are symbolic variables.
Now, I have a variable y which value is 0 and my script goes :
C = subs(C, xi, y);
which I would expect to give -xj * lp * exp, but what I actually get is lp. When I do the substitution on the expression only, I get, the right result.
Any idea ?

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

回答 (1 件)

Johannes Korsawe
Johannes Korsawe 2013 年 10 月 31 日
C(C==exp1) = exp2;
??

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by