I want to take modulus of complex number in polar coordinates in matlab .

5 vues (au cours des 30 derniers jours)
bushra kanwal
bushra kanwal le 10 Août 2021
Commenté : Bjorn Gustavsson le 11 Août 2021
For examle how to calculate mod of 1+ a cos(theta)+ i asin(theta) on matlab

Réponses (1)

Bjorn Gustavsson
Bjorn Gustavsson le 10 Août 2021
The only definition of modulus of a complex number I can find is what is done with the abs-function. In that case you simlpy do:
z = 1+a*cos(theta) + 1i*a*sin(theta); % using 1i to make sure it is the imaginary unit.
abs(z)
Here I also assumed that you wanted a*sin(theta) and not 1i*asin(theta)
HTH
  2 commentaires
bushra kanwal
bushra kanwal le 11 Août 2021
but it gives only the symbol of modulus. this syntax does not provide calculated modulus
Bjorn Gustavsson
Bjorn Gustavsson le 11 Août 2021
No it doesn't:
a = 12;
theta = sqrt(2);
z = 1+a*cos(theta) + 1i*a*sin(theta); % using 1i to make sure it is the imaginary unit.
abs(z)
ans =
12.1960
As it should. If you're working with symbolic variables then that's another case which you might not get further, but why bother about that, you know what it should be and can simply replace (see help and documentation for subs) it when necessary.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by