comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Writing exp(-j*!pi) in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Writing exp(-j*!pi) in IDL [message #92518] Mon, 04 January 2016 01:08 Go to next message
alghafisuct is currently offline  alghafisuct
Messages: 20
Registered: November 2014
Junior Member
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
Re: Writing exp(-j*!pi) in IDL [message #92520 is a reply to message #92518] Mon, 04 January 2016 02:11 Go to previous message
Yngvar Larsen is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: FL ARMed!
Next Topic: How do I create a plot which looks something like a Matrix Plot in IDL ?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:11:11 PDT 2025

Total time taken to generate the page: 0.00407 seconds