matlab switch complex and real parts of a number -
i have column list of complex numbers (about 200k long). want switch real , imaginary parts. i'm pretty sure there single multiplication can accomplish this, can't find formula online. best way i've found far it's slow needs (it needs run realtime):
>> vec = [complex(1,11);complex(2,22);complex(3,33)] vec = 1.0000 +11.0000i 2.0000 +22.0000i 3.0000 +33.0000i >> complex(imag(vec),real(vec)) ans = 11.0000 + 1.0000i 22.0000 + 2.0000i 33.0000 + 3.0000i
i'm not sure if there built-in operation this, see speed increase not using complex function:
>> imag(vec) + real(vec)*1i ans = 11.0000 + 1.0000i 22.0000 + 2.0000i 33.0000 + 3.0000i and way
>> conj(vec)*1i ans = 11.0000 + 1.0000i 22.0000 + 2.0000i 33.0000 + 3.0000i which think looks lot cleaner.
Comments
Post a Comment