using relational operators with the symbolic math toolbox?
2 次查看(过去 30 天)
显示 更早的评论
is there anyway i can use relational operators with the symbolic math toolbox? i have read the other answer for the same question and it wasn't very clear to me. could someone please explain?
0 个评论
采纳的回答
Walter Roberson
2011-2-19
Yes, there is a MuPad call named "is" that will test a condition. It is not strictly constrained to numeric relations: it can test properties such as data types, and when assumptions have been applied, it may be able to decide relationships between expressions that involve symbolic variables. Most of the time, though, expressions that involve symbolic variables without assumptions are not decidable, and is() will return false for those cases.
Coding the relational expression at the Matlab level can be a problem, so you usually end up having to express it as a string and using subs() to transfer the values from the Matlab engine to the symbolic engine.
0 个评论
更多回答(1 个)
Andrew Newell
2011-2-19
If you have assigned numeric values to your symbolic variables, you could do something like this:
syms x y
x = 1; y = 2;
if double(y) > double(x)
disp('True is true!')
else
disp('Doubleplusungood.')
end
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!