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

Home » Public Forums » archive » Re: IDL QUESTIONS (INTERPOLATION)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL QUESTIONS (INTERPOLATION) [message #78359] Mon, 21 November 2011 11:00 Go to previous message
zolile mtumela is currently offline  zolile mtumela
Messages: 50
Registered: September 2011
Member
On Nov 21, 7:54 pm, David Fanning <n...@dfanning.com> wrote:
> zolile mtumela writes:
>
>> Hi all,
>> I have interpolated some data, which I think I did well,  the data
>> looks like this
>>       time  (s)       velocity
>>     24785555     -8.90000
>> ...
>> I want to create time axis in hours, I need  help on time convetion, I
>> wrote a program like this
>> File = Dialog_pickfile(Filter = '*.txt')
>
>> ;read the data
>> rows = File_lines(file)
>> data = Fltarr(2,rows)
>> openr,Lun,file,/Get_lun
>> ReadF,lun, data
>> b =floor(min(data[0,*])); start time
>> e = ceil(max(data[0,*])); end time
>> x = Scale_vector(Findgen(e-b+1),b,e)
>> y = interpol(data[1,*], data[0,*],x); interpolating data
>> ;draw the plots
>> plot,data[0,*],data[1,*],linestyle=2       ; for original data
>> oplot,x,y,color=120            ; newly interpolated velocity data
>
>> end
>> I want to covert that time in two hour in the plot.
>
> Maybe you want something like this:
>
> rows = File_lines(file)
> data = Dblarr(2,rows)
> openr,Lun,file,/Get_lun
> ReadF,lun, data
> data[0,*] = data[0,*] - Min(data[0,*]) ; Elasped time
> b =floor(min(data[0,*])); start time
> e = ceil(max(data[0,*])); end time
> x = Scale_vector(Findgen(e-b+1),b,e)
> y = interpol(data[1,*], data[0,*],x); interpolating data
> ;draw the plots
> cgplot,data[0,*]/3600.,data[1,*], xtitle='Hours' ; for original data
> cgplots,x/3600.,y,color='red', PSYM=3          ; newly interpolated
> velocity data
>
> end
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")- Hide quoted text -
>
> - Show quoted text -

cgplot,data[0,*]/3600.,data[1,*], xtitle='Hours' ; for original data
cgplots,x/3600.,y,color='red', PSYM=3 ; newly interpolated
velocity data


end

Thank so much David, for time axis it looks ok.
I am bit confused why at the y-axis(velocity), my program plot big
values which are not in the data. I got big values like(500)
After interpolation, Is it necessary to resample data? Are any better
way to use interpolation in this kind of data.

Thank so much for ur tireless support and help
Zolile
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: unicode conversion
Next Topic: Re: IDLDoc Error

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

Current Time: Fri Oct 10 13:25:18 PDT 2025

Total time taken to generate the page: 0.64117 seconds