subs('N*g', 'N', 'tg/u')
subs('N*g', 'tg/u', 'N')
these two code lines give the same result:
(g*tg)/u
but the first line should give back:
(g*tg)/u
and the second result should be:
N*g
since there is no 'tg/u' which could be substitued...
techdoc says:
subs(S,old,new)
so i think it should only look for 'old' and change to 'new', not vice versa.
any idea how can i avoid that subs function changes 'new' to 'old' in the S expression?

 채택된 답변

Sean de Wolski
Sean de Wolski 2012년 2월 23일

1 개 추천

This is functionality available for backward compatibility. If the old does not occur, but the new does, it switches them.
doc subs

댓글 수: 2

Walter Roberson
Walter Roberson 2012년 2월 23일
This is *documented* functionality.
http://www.mathworks.com/help/toolbox/symbolic/subs.html
If subs(s,old,new) does not change s, subs(s,new,old) is tried. This provides backwards compatibility with previous versions and eliminates the need to remember the order of the arguments. subs(s,old,new,0) does not switch the arguments if s does not change.
Tamás Király
Tamás Király 2012년 2월 24일
thanks for pointing that out. I don't understand how did i missed that part of documentation...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

질문:

2012년 2월 23일

편집:

2013년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by