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

Home » Public Forums » archive » about interpolation!
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
about interpolation! [message #79614] Mon, 19 March 2012 23:17
zolile mtumela is currently offline  zolile mtumela
Messages: 50
Registered: September 2011
Member
Dear all,
I have a program that is working, but I want a way of avoiding to put
data manual and the program runs as it run when a put data manualy.

pro test_interpol
!p.multi=[0,1,2]

time20 = [24787475, 24787715, 24787835, 24787955, 24788075, 24788315,
24788435, 24788675, 24788915, $

24789155, 24789275, 24789395, 24789515 ]


vel20= [35.4000, 0.000, -58.5000, -17.4000, 0.000, 18.8000, 0.500,
-40.9000, 0.00, $

39.0000, 51.7000, 58.1000, 54.2000]


U = [24782520, 24782640, 24782760, 24782880,24783000, 24783120,
24783240, 24783360, 24783480, 24783600, $

24783720, 24783840, 24783960, 24784080, 24784200, 24784320, 24784440,
24784560, 24784680, 24784800, $

24784920, 24785040, 24785160, 24785280, 24785400, 24785520, 24785640,
24785760, 24785880, 24786000, $

24786120, 24786240, 24786360, 24786480, 24786600, 24786720, 24786840,
24786960, 24787080, 24787200, $

24787320, 24787440, 24787560, 24787680, 24787800, 24787920, 24788040,
24788160, 24788280, 24788400, $

24788520, 24788640, 24788760, 24788880, 24789000, 24789120, 24789240,
24789360, 24789480, 24789600]
; interpole the data
Result20 = interpol(vel20,time20,U)
;draw the plots
;plot, (time20-time20[0])/3600., vel20, linestyle = 1, max_value=60,
min_value=-60
;plot the interpolated values
plot, (u-u[0])/3600., result20, max_value=60, min_value=-60
N = n_elements(result20)
;print, N
T = 120; sampling period
;claculate spectrum for each interpolated results
Spec20 = fft(hanning(60)*result20)
freq_axis =findgen(N)/(N*T)
; plot the spectrum of each results
plot, freq_axis[0:N/2],[abs(spec20[0:N/2])]^2,xrange = [0.001, 0.005]
!p.multi = 0
end
I wrote the following program hence I have many data to run, but this
doesnot give the same results, I real ask for help and advices
please, Its been a while trying to sortout this issue, I am not
winning.
!p.multi=[0,1,2]
;select the data file
File = Dialog_pickfile(Filter = '*.txt')
;read the data
rows = File_lines(file)
data = dblarr(2,rows)
print,data
openr,Lun,file,/Get_lun
ReadF,lun, data
data[0,*] = data[0,*]-min(data[0,*]); elapsed time
b = floor(min(data[0,*])); start time
e = ceil(max(data[0,*])); end time
x = Findgen(e-b-1); time
interp_vel = interpol(data[1,*], data[0,*],x); interpolating data
T=120.0
;draw the plots
plot,data[0,*]/3600.,data[1,*],linestyle=2
;ytitle='vel [m/s]',title='Velocity for range',$
;xtitle='UT',max_value=2000, min_value=-2000; yrange=[-30,30]; for
original data
;oplot,x/3600.,interp_vel, color=120 ; newly interpolated velocity
data
N=n_elements(interp_vel)
print, N
spec = fft(interp_vel)
freq_axis = findgen(N)/(N*T)
spec=fft(interp_vel)
freq_axis=findgen(N)/(N*T)
plot,freq_axis[0:N/2],abs(spec[0:N/2]),xrange=[0.001,0.005]
end

I am expecting to have N=60, hence the time interval is 120. Your help
is highly appreciated.
Many thanks
Zolile
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Important Coyote Graphics Updates
Next Topic: Convert from raster to PNG

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

Current Time: Wed Oct 08 18:52:25 PDT 2025

Total time taken to generate the page: 0.00548 seconds