Assign value to individual components of the complex number

2 vues (au cours des 30 derniers jours)
Jack Daniels
Jack Daniels le 4 Nov 2022
Commenté : Matt J le 7 Nov 2022
I'd like to assign the value to individual components of the complex numer.
>> x = 1;
>> y = 1;
>> H = complex(x,y);
Now I'd like to change the only real part and only the imaginery part
pseudocode: H.real = 10;
pseudocode: H.imag = 10;
and expecting
pseudocode answer: H = 10+10i
How to do it in Matlab?

Réponses (1)

Matt J
Matt J le 4 Nov 2022
H=complex(10,imag(H))
H=complex(real(H),10)
  8 commentaires
Jack Daniels
Jack Daniels le 7 Nov 2022
Great! Thank you!
Matt J
Matt J le 7 Nov 2022
You're quite welcome, but if you are happy with the answer, please Accept-click it.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by