Jump to content

"Normalize" different scaled measured data


N.T.

Recommended Posts

I have a test rig capturing different values from sensors (momentum, position etc). Unfortunately those devices are USB, non-realtime and don't give a timestamp. I record the values within parallel loops and also storing the current time stamp value using the timer with high accuracy. Access times to the usb devices differ so I don't have a common timebase for the measurement.

I eventually have a couple of arrays containing the values and timestamps.

Now I try to bring them all to a common time base. I look up the first and the last timestamp, use the ramp pattern vi to create a fixed time interval and use the sum of the number of all arrays to not loose values inbetween.

Unfortunately, the Interpolate 1D array vi is not capable of shifting the start time to bring the specific array within the start/end Range.

As a very simplified example:

Array A
Timestamp   1    2    3    4    5    6    7
Value       10   30   50   70   90   110  130

Array B
Timestamp   1.5  2.5  3.5  4.5  5.5  6.5  7.5
Value       20   40   60   80   100  120  140

Data after merging
Timestamp	1.0   1.5   2.0   2.5   3.0   3.5   4.0   4.5   5.0   5.5   6.0   6.5   7.0   7.5	
Value A		10    20    30    40    50    60    70    80    90    100   110   120   130   ---
Value B		---   20    30    40    50    60    70    80    90    100   110   120   130   140

Have you any idea how to solve this?

So far....png

Link to comment

Forget my previous reply, I was in a rush.

The loop where you use the interpolation is wrong, because of different array lengths. Y and X should be of same size for Interpolate 1D.vi.
The time channels for each device should be fed to the Interpolate 1D.vi, not the concatenated time channel.
You shouldn't build a 2D array from your raw signals anyway (what happens if your different devices are not in sync and array lengths differ?), you should compose it as an array of clusters, and each cluster should be of the time array and the signal array. It will be easier to work with that and easier to put them on graph.

I can't comment on your common time channel generator code, I guess you tested it and is okay. Since the time is "commonized" and everything will have the same length, the interpolated signals can be put in a 2D array.

image.png.05fa6201f0d21a73b5573cf047277bf7.png

 

Edited by Lipko
Link to comment

Thank you for your help.

Unfortunately the lenght is not normalized. But that's, what Interpolate 1d does. It's quite a mess, but it's working.

A real pain is the behavior of the interpolate 1d vi, as it is using the given points as center for it's interpolation. You cannot specify the given point to be the beginning.

Direction and Servo Load are binary values (as doubles) that have only 11 members, whereas the other arrays have around 2000-6000 members. The interpolation doesn't help that much.

But that's another matter.

Link to comment

I honestly don't understand how it can work at all, I didn't test your code (for some reason drag-dropping the snippet doesn't work for me). Your signal arrays doesn't match: Y is the original signal while X is the common concatenated and sorted time, so it can even be 0,0,0,0,1,1,1,1,2,2,2,2 and so on. And you fed this to the interpolator, no wonder it might behave strangely depending on the test data. But even if it doesn't look strange, your code will produce wrong results.

Did you try my code? It's not a big change to implement.

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.