Re: Writing exp(-j*!pi) in IDL [message #92520 is a reply to message #92518] |
Mon, 04 January 2016 02:11  |
Yngvar Larsen
Messages: 134 Registered: January 2010
|
Senior Member |
|
|
You could define
j = complex(0,1) ; single precision
or
j = dcomplex(0,1) ; double precision
Note also that for purely imaginary input, the following is much faster than EXP(j*OFFSET_DEG*!dtor) if OFFSET_DEG is a large array:
offset_rad = offset_deg*!dtor
ph_offset = complex(sin(offset_rad), cos(offset_rad)) ; single precision
or
offset_rad = offset_deg*!const.dtor
ph_offset = dcomplex(sin(offset_rad), cos(offset_rad)) ; double precision
--
Yngvar
On Monday, 4 January 2016 10:08:41 UTC+1, algha...@gmail.com wrote:
> Hi
>
> I was trying to write a code and I have problem with the -j as the following in IDL
>
> Phase = array_VV*conj(array_HH*exp(j*!pi/180))
>
> Result_Phase = image(180/!pi*ATAN(Phase*exp(-j*Offset_degree/180*0)))
>
> I had problem with defining the -j and j and do not know how to do it in IDL is there other way?
>
> I'm trying the same thing in MATLAB as follow and it's working
>
> Phase = array_VV*conj(array_HH*exp(j*pi*0))
>
> imagesc(180/pi*angle(Phase*exp(-j*Offset_degree/180*pi)))
>
> I guess I did not present j and -j and there is a way of doing it in IDL
>
> Thanks
|
|
|