Jump to content

Expand 33 entry array to 1024 with interpolation


Aaron L

Recommended Posts

Hello,

I'm attempting to take a 33 entry array, expand it to 1024 entries with the 33 original entries evenly spaced. Then, I need to linearly interpolate between each of those 33 spread-out entries and fill in the remaining 31 blank entries in between each original 33 now evenly spaced entries.

I've found one example about using array expansion, but I have to do this operation many times, so I need to be more efficient about it. This is to fill up a lookup table (LUT).

Ex:

Take the original:

1

2

3

...

30

31

32

And create the expanded:

0

(1/32 * (entry 0 - entry 1))

(2/32 * (entry 0 - entry 1))

...

(31/32 * (entry 0 - entry 1))

1

(1/32 * (entry 1 - entry 2))

...

I can perform this expansion in a brute force method, but the Interpolate 1D Array VI suggests a much more effecient method that escapes me. There doesn't seem to be any good examples for the general operation of the Interpolate 1D Array VI to learn from. It appears to auto-index and take care of several operations at once, requiring a non-indexed entry into a FOR loop.

Any guidance is greatly appreciated.

Link to comment

QUOTE (Aaron L @ Sep 2 2008, 06:26 PM)

Depending on how often you will need to access this 1024 item LUT I would not bother with creating it but rather work directly from the 33 item LUT:

http://lavag.org/old_files/monthly_09_2008/post-1022-1220403372.png' target="_blank">post-1022-1220403372.png?width=400

The code above allows you to specify a base 1024 index that interpolates the answer from the base 33 LUT.

If you will be accessing the base 1024 LUT very often it might make sense to create an actual LUT. Just take the code above and run it through a for loop.

Cheers,

Heiko

Link to comment

QUOTE (Neville D @ Sep 2 2008, 04:28 PM)

Look at the Align and Resample Express VI.

Neville,

Thank you for the suggestion and direction. Attached is a VI I made using the Align and Resample function as well as just the Resample function. The VI contains both versions and show the difference. One thing I had to do was add one point to the end of the array to box in my endpoints. For whatever reason, the resample leaves off the last point.

One thing I also had to do was make sure my original data point values showed up in the resampled waveform. This means only 2^(-n) sampling could be used. Fortunately, my resampling is 1/32, so I lucked out there.

Hopefully this will be helpful to someone in the future for expanding arrays in labview using resampling.

Link to comment

QUOTE (Aaron L @ Sep 3 2008, 10:35 AM)

Neville,

Thank you for the suggestion and direction. Attached is a VI I made using the Align and Resample function as well as just the Resample function. The VI contains both versions and show the difference. One thing I had to do was add one point to the end of the array to box in my endpoints. For whatever reason, the resample leaves off the last point.

One thing I also had to do was make sure my original data point values showed up in the resampled waveform. This means only 2^(-n) sampling could be used. Fortunately, my resampling is 1/32, so I lucked out there.

Hopefully this will be helpful to someone in the future for expanding arrays in labview using resampling.

Great! As a sidenote, if using the ExpressVI, double-click it, change to VI and then edit it to remove unnecessary functionality and data conversions to get better performance. Digging around inside might also point you to why you seem to be losing the last pt on resample.

<EDIT>: Playing around with Open or Closed Interval boolean in the ExpressVI seems to generate the extra last pt, but I can't seem to get my head around the concept at the moment..

N.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.