Real function for symbolic variables
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
why does
>>real(2+3*i)
give me an error message while
>> imag(2+3*i)
ans =
3
works?
0 commentaires
Réponses (3)
the cyclist
le 16 Oct 2011
What error message do you get? Neither of those commands gives an error for me. Might you have redefined the real() command somehow? Does
>> which real
give the expected file location? (It should be a built-in function in the elfun directory structure.)
0 commentaires
Walter Roberson
le 16 Oct 2011
2+3*i would not inherently involve the symbolic toolbox, not unless you have overwritten "i" with a symbolic variable.
Is the 2+3*i perhaps a value that you had returned from a symbolic calculation without using double(), and is thus sym('2+3*i') ?
0 commentaires
David Koenig
le 17 Oct 2011
Thanks for the responses, the cyclist and Walter Roberson. I think my problem had to do with not declaring the variables properly in a syms statement. I have since been more careful and have resolved the issues - and using 2011a instead of 6.1 has made a pleasant difference.
0 commentaires
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!