Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Problem in assignning the real of complex number

1 visualización (últimos 30 días)
ahmed
ahmed el 17 de Nov. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello
I want to assign the real of certain complex number,for example
x=2+2*j;
when i write the following command real(x)=0;
matlab output the following error Subscript indices must either be real positive integers or logicals.
but i don't understand the reason, can anyone help me
Thanks

Respuestas (2)

Azzi Abdelmalek
Azzi Abdelmalek el 17 de Nov. de 2013
Editada: Azzi Abdelmalek el 17 de Nov. de 2013
x=2+2*j;
real(x) will return the real part of x , if you want to assign 0 to real(x) , just write
x=imag(x)*i
%or
x=new_x+imag(x)*i

Andrei Bobrov
Andrei Bobrov el 17 de Nov. de 2013
x = complex(0,imag(x))

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by