필터 지우기
필터 지우기

How can I replace some symbolic values in a matrix?

조회 수: 10 (최근 30일)
Dina Irofti
Dina Irofti 2014년 3월 4일
댓글: Dina Irofti 2014년 3월 6일
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
Dishant Arora 2014년 3월 4일
The replacement doesn't take place, then what do you get?? It should work fine.
Dina Irofti
Dina Irofti 2014년 3월 4일
The same matrix A, with the symbolic elements unreplaced

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

채택된 답변

Walter Roberson
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})
  댓글 수: 3
Dina Irofti
Dina Irofti 2014년 3월 5일
This is the error
Error using mupadmex
Error in MuPAD command: Invalid variable. [stdlib::diff]
Error in sym/subs>mupadsubs (line 146)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 119)
G = mupadsubs(F,X,Y);
Version: R2012a
Dina Irofti
Dina Irofti 2014년 3월 6일
You were right: it works if I use another version of Matlab.
Thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by