How to substitute numerical into symbol?
10 views (last 30 days)
Show older comments
I need to substitute 0 for certain symbols in an calculation, however it is not doing what I want it to do. The function I have used are listed below as an example:
syms A1 A2 A3 A1_ A2_ A3_
a= A1*A1_+A2*A2_+A3*A3_*2
b= A1*A1_+A2*A2_+A3*A3_
c = subs(a, [A1*A1_,A2*A2_,A3*A3_],[0,0,0])
d = subs(b, [A1*A1_,A2*A2_,A3*A3_],[0,0,0])
but the ans I got is
c =
2*A3*A3_
d =
0
If the symbol on its own, the subs function will work. However, if the symbol is not on its own, such as (A3*A3_)^2 or (A3*A3_)*2, the ans will be similar to c which should be equal to 0 instead of 2*A3*A3_.
Is there anyway or any other function will make the substitution work?
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!