Re: Subtracting from double complex array [message #92540 is a reply to message #92539] |
Sun, 10 January 2016 02:18   |
alghafisuct
Messages: 20 Registered: November 2014
|
Junior Member |
|
|
On Saturday, January 9, 2016 at 1:02:09 PM UTC-8, Jim P wrote:
> On Saturday, January 9, 2016 at 7:53:59 AM UTC-7, algha...@gmail.com wrote:
>> Hi all
>>
>> I have a double complex array for example 500 by 500 and I want to subtract (3.5e14 + j 2.5e12) from all the values in the complex array that I have... Is there a way of doing it in IDL
>>
>> Thanks
>
> IDL> a = dcomplexarr(500, 500) ; your array, simulated with zeroes
> IDL> a -= dcomplex(3.5d14, 2.5d12) ; subtracts the scalar from all elements
> IDL> print, a[0]
> ( -3.5000000e+014, -2.5000000e+012)
>
> Jim P.
Thanks Jim I tried what you gave me and seems like not getting what I want. I have the following:
array_HV = make_array(5000, 5359, /dcomplex, /nozero)
filename_HV = ('C:\Users\asus\Desktop\Metasensing\IDL_PROJECTS\20151021115 853_12_SAR_CPLX_0_pres_8.dat')
OPENR, importUnit, filename_HV, /GET_LUN
READU, importUnit, array_HV
CLOSE, importUnit
FREE_LUN, importUnit
array_HV = dcomplexarr(5000, 5359) ; your array, simulated with zeroes
array_HV -= dcomplex(3.6435137d11, 1.6869517d12) ; subtracts the scalar from all elements
print, array_HV[0]
The value of array_HV at [2798,2263] is (3.6435137d11, 1.6869517d12) so if I subtract it should read zero when I write print, array_HV- [2798,2263] but It did not give me zero. It is giving the following:
IDL> print, ARRAY_HV -[2798,2263]
( 3.6435137e+011, 1.6869517e+012)( 3.6435137e+011, 1.6869517e+012)
IDL> print, ARRAY_HV [2798,2263]
( 3.6435137e+011, 1.6869517e+012)
Hope you got my point
Thanks
|
|
|