フィルターのクリア

Substitution problem in matlab

1 回表示 (過去 30 日間)
Michael Elman
Michael Elman 2018 年 9 月 13 日
コメント済み: madhan ravi 2018 年 9 月 13 日
Hello, I'm new in matlab, and I'm trying to learn operations with variables,so I have encountered a little problem, that I don't quite understand, why
ER=subs(yp,{sx},{1})
ER=subs(yp,{sy},{1})
it's not a same thing, as
ER=subs(yp,{sx,sy},{1,1})
? In first case the answer is
-y*(exp(-x^2/sx^2)*exp(-y^2) - 1)
(and I don't want sx^2) and in the second case the answer is
-y*(exp(-x^2)*exp(-y^2) - 1)
(this is exactly, what i need)
This is my starting code:
syms x y z;
syms sx sy;
yp=y*(1-exp(-x^2/sx^2)*exp(-y^2/sy^2))
Does someone know what's the reason behind it?
  1 件のコメント
madhan ravi
madhan ravi 2018 年 9 月 13 日
編集済み: madhan ravi 2018 年 9 月 13 日
Can you format the code by selecting the whole code and clicking the code button?

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

採用された回答

madhan ravi
madhan ravi 2018 年 9 月 13 日
編集済み: madhan ravi 2018 年 9 月 13 日
syms x y z;
syms sx sy;
yp=y*(1-exp(-x^2/sx^2)*exp(-y^2/sy^2))
ER=subs(yp,{sx},{1})
ER=subs(ER,{sy},{1})
ER1=subs(yp,{sx,sy},{1,1})
Reason: when you wanted to substitute for sy the second time you should type ER instead of up because you’re replacing the old equation again
TYPE:
ER=subs(ER,{sy},{1})
INSTEAD OF:
ER=subs(yp,{sy},{1})
  2 件のコメント
Michael Elman
Michael Elman 2018 年 9 月 13 日
Thank you!
madhan ravi
madhan ravi 2018 年 9 月 13 日
you're welcome :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by