How can I replace some symbolic values in a matrix?
10 次查看(过去 30 天)
显示 更早的评论
Hello!
I have a (symbolic) matrix A and its components depend on some symbolic variables (x, y and z). I want to replace the symbolic values with zero and I used subs function:
A = subs(subs(subs(A, x, 0), y, 0), z, 0);
and it doesn’t work (the replacement don’t take place) It doesn’t work either:
A = subs(A, x, 0);
What can I do to replace my symbolic variables with zero in this case?
Thanks!
2 个评论
Dishant Arora
2014-3-4
The replacement doesn't take place, then what do you get?? It should work fine.
采纳的回答
Walter Roberson
2014-3-4
Did you assign a value to x, y, or z at the MATLAB level? If so then when it is the value of x, y, or z that is going to be used in the subs(), not the symbol. You might be able to use
subs(A, {sym('x'), sym('y'), sym('z')}, {0, 0, 0})
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!