Subs function invalid operand message

Hello all,
I'm trying to evaluate several boolean expressions which involves symbolic variables D and R.
When I try to evaluate
f3 = ~R & ~D
R = 0; D = 0;
subs(f3)
ans =
~0
it works fine.
But for some reason, several expressions occur "Invalid operand" error message.
For example:
f3 = ~D & R
R = 0; D = 0;
subs(f3)
Error using symengine
Invalid operand.
Error in sym/subs>mupadsubs (line 160)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 145)
G = mupadsubs(F,X,Y);
However, if I try to evaluate the expression above without symbolic variables:
~0 & 0
ans =
logical
0
it works perfectly.
Any suggestions how to solve this issue?
Thanks in advance.

6 件のコメント

madhan ravi
madhan ravi 2019 年 3 月 12 日
why do you convert it to symbolic variable ?
or ohev shalom
or ohev shalom 2019 年 3 月 12 日
Do you mean in the first place?
Because the expressions are built in a for loop, each time a different expression..
madhan ravi
madhan ravi 2019 年 3 月 12 日
subs(f3,{R,D},{0,0})
or ohev shalom
or ohev shalom 2019 年 3 月 12 日
Gives the same expression without evaluation...
temp = subs(f3,{R,D},{0,0})
temp =
~D & R
madhan ravi
madhan ravi 2019 年 3 月 12 日
編集済み: madhan ravi 2019 年 3 月 12 日
What does the below show? , when you type it in command window
whos R
whos D
or ohev shalom
or ohev shalom 2019 年 3 月 12 日
Correction:
If R and D are symbolic then
subs(f3,{R,D},{0,0})
gives the same error.
If R and D are changed to logical\double (after building the expression) then I get
temp = subs(f3,{R,D},{0,0})
temp =
~D & R

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

回答 (0 件)

製品

リリース

R2018b

質問済み:

2019 年 3 月 12 日

編集済み:

2019 年 3 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by