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

Home » Public Forums » archive » Re: how to extend a vector from size A to size B, (A<B) without "damage" the data in A
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: how to extend a vector from size A to size B, (A<B) without "damage" the data in A [message #79514 is a reply to message #79505] Wed, 07 March 2012 21:37 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Wednesday, March 7, 2012 4:51:20 PM UTC-5, Tito wrote:
> Hi all!
>
> I have the fowling problem:
> I have a array vector A with size [970] elements lets say, and another that is 'B' with [1024] elements. now... both contain spectra and I want to do cross-correlation between the two vectors. This will be possible if A is 1024 element vector.
>
> I am new in IDL and shoot and try several thing here like:
> A = interpol(A,1024)
> and I saw also someone suggested:
> A = [A, intarr(n_elements(B)-n_elements(A))] , but doesn't give me what I want.
>
> A is synthetic spectra (mask) and I just want to increase the resolution without losing the quality of the data(the relative distances between the lines)
>
> A = interpol(A,1024), actually works, but I see very obvious differences in the 970 and the result spectra.

I think you need to define your problem a little more clearly.

Either your A spectrum is sampled on a different grid than B, or it is simply truncated. Either way you have to make an assumption about the quality of your data.

Sampled on a different grid means that the spacing between measurement points in A was different by about 5.3%, or it could also mean uneven sampling of A. Your best bet in this case is to do some form of interpolation, to put them on the same grid. The assumption you would need to make here is that the values vary smoothly from point to point, so that the missing data can be represented by its interpolant. Yes, there could be aliasing artifacts, but I think those would be minimized by doing sinc-interpolation, maybe cubic spline is OK. Both spl_init/spl_interp and interpolate() offer smoothly varying interpolation functions.

If instead A is *truncated* then things are easier. You need to pad your A to the full length. The assumption you make here is that the missing data do not contain useful information, so there is no harm in padding the series. It's probably best to pad with the mean value of your series instead of zero like you indicated above.

Best wishes,
Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Question about storing arrays in pointer array.
Next Topic: Re: using cgSurface to produce a scatter 3D plot with 4th dimension

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

Current Time: Sun Oct 12 10:34:25 PDT 2025

Total time taken to generate the page: 0.87711 seconds