Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

02-09-2010 03:41 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi, guys

I hope somebody can give a little hint. I've two arrays with the following data

Encoder Array

Index 0,1,2,3,4,5,6,7,8,9,10

Value 0,10,20,27,38,43,50,55,65,73,90,100

Signal Array

Index 0,1,2,3,4,5,6,7,8,9,10

Value 0,1.0,2.0,2.7,3.8,4.3,5.0,4.5,3.5,2.8,1.0,0

So basically I "just" want to align the SignalArray values with the EncoderArray values and then interpolate the data points (not only for display reasons so I would need the adjusted data in an array).

My first idea was to rebuild the Signal Array using the values out of the encoder array as an index. If I create an empty 100 value array, I can write the samples from the signal array into the right indices (corresponding to whatever the encoder value was) but now I've Zero-values in between and can't get the interpolation functions to work properly.

I'm sure that's a very simple task for an experienced LV user but since I'm a newbie I've a hard time with it. Any help is highly appreciated. Thanks.

smercurio_fc

Knight of NI

02-09-2010 08:43 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

02-10-2010 09:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

smercurio_fc

Knight of NI

02-10-2010 09:32 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

You're still not being precise or even clear in your descriptions. What does "equal spacing" mean to you? It means one thing to me. It means something else to somebody else. For the array 0,10,20,27,38,43,50,55,65,73,90,100 what's "equal spacing" supposed to be? Every value that's a multiple of 10? Every value that's a multiple of 5? Every value that's a multiple of 6.235? What about the array 0,1.0,2.0,2.7,3.8,4.3,5.0,4.5,3.5,2.8,1.0,0? That's even less clear by what you mean by "equal spacing".

As for eliminating zeros out of the array, how is the array accumulated in the first place? If you're doing it one element at a time then you can use a trivial solution of conditionally adding to the array using a case structure that's driven by a check to see if the value is nearly zero. NOTE that I said __nearly zero__. Don't try to use a Equal operator on zero and come back and complain that LabVIEW has a bug that it can't compare a float to be equal to zero. If you're trying to do this after the fact there are several ways to do this. If you search the forum you will see this question has come up many times, and several solutions have been posted.

02-10-2010 10:26 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I'm also unclear what you are trying to do to "align" the data. Isn't the signal data at index 3 representing the data taken when the encoder was at index 3? If you were to graph it out with signal data on one axis and encoder data on the other, wouldn't that be representative of the aquired data? If so then there are LabVIEW functions to do various curve fits, with one array supplying the X-axis data, the other the Y, to interpolate between, I presume, the encoder inputs.

Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.

Currently using LV 2012-LabVIEW 2018, RT8.5

02-10-2010 11:47 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hello,

It sounds like you simply want to define the sampling interval between the data points in your array. If these are evenly sampled, the attached example should help. By graphing the points as a waveform, you include the sampling interval:

-Zach

02-10-2010 11:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

<If you were to graph it out with signal data on one axis and encoder data on the other, wouldn't that be representative of the acquired data?>

Exactly this is what I'm trying to do. I guess, the graph would use some internal "interpolation" to connect the points which I provided. But as I mentioned in the initial post, I do not only need the graph but the final "interpolated" data in an array which I can later search for specific values (even those values which I didn't provide in the first place). For example, I've a sensor reading at encoder position 50 and another one at position 65. But I need to know what the reading would have been at let's say encoder position 54. I know, that will be just a calculated value but likely very close to what has been the "real" value.

02-10-2010 11:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

So why dont you fit your data to a curve?

Once you have a formula that describes the curve, you can generate an array with however many points you want, with any dt you want.

Cory K

02-10-2010 12:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.

Currently using LV 2012-LabVIEW 2018, RT8.5