LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

re-sample and add two signals

Hi,

I have a problem about re-sampling signals. I have two sampling signals with different sampling rates. I want to add these two signals together into one output signal. But when I just use "add" buffer, an error occurs and it tells me that two signals with different time intervals can't be added. So I tried to use "Re-sample" block to re-sample sound card signals. But it seems that this function can't re-sample signals with smaller time interval, which means it can't add samples when sampling. 

Can anybody help me solve this problem? Or do you have any ideas that can help me add these two signals? My file is below.

Many thanks!

0 Kudos
Message 1 of 4
(2,100 Views)

Just for the sake of argument, let's assume you have one second of data and sample the same data at 10 Hz and at 100 Hz, and you want to "add" them.  You clearly need to "add" arrays of the same size, so you'll either want to "expand" the 10 samples of the 10 Hz array to 100 points or "shrink" the 100 points of the 100 Hz array down to 10.

 

How do you want to do this?  Shrinking is easy -- there are two choices:  pick one point in every 10 (a process called "decimation") or replace the 10 points by their average (which may be more representative of the 10 points than one chosen from the set of 10).  Expanding means "filling in the blanks", a process called "interpolation".  Again, you have a number of choices -- a "step" function (repeat each point 10 times) or "connecting the dots" (a straight line between adjacent points).

 

It gets a little more complex if the samples are not in an 1:N ratio, forcing a mix of interpolation and decimation.  But once you have the two signals as arrays (or waveforms) that have the same size, just add them!

 

Bob Schor

0 Kudos
Message 2 of 4
(2,078 Views)

Thank you for your reply!  As you said, I want to expand 10 samples to 100 samples to make time interval of two signals same. I will try your method and see if it works.

0 Kudos
Message 3 of 4
(2,072 Views)

Of course it will work!  You just need to decide if you want a "stair-step" or a "connect-the-dots" 100-point array.

 

Bob Schor

0 Kudos
Message 4 of 4
(2,065 Views)