using relational operators with the symbolic math toolbox?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Walter Roberson
le 19 Fév 2011
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 commentaires
Plus de réponses (1)
Andrew Newell
le 19 Fév 2011
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 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!