LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass the sum of 2 waveforms through a threshold?

Hi,

I have two waveforms - a square wave (Generate Waveform.vi), and a signal i'm acquiring through my soundcard. I add these two signals using the numeric add function. Now I want to threshold the summed waveforms using the Threshold Peak Detector PtByPt vi, but the output of the adder function cannot be wired to the input of the threshold function.

How could I get around this? Do I have to convert the summed waveform (which I'm assuming is stored in a 1-D array) to some other form before it can be given as input to the threshold?

Thanks in advance

0 Kudos
Message 1 of 10
(3,591 Views)
I've attached a screenshot of what I'm working on.. I need the threshold vi placed between the adder function and the array, but whatever I do is causing data mismatches. What am I doing wrong?
0 Kudos
Message 2 of 10
(3,588 Views)
It seems that you just need to use the Convert from Dynamic Data function. You can find this in the Express -> Signal Manipulation -> From DDT. You need to specify what to convert from, which is probably a 1D array of scalars. This will give you an array of values that you can auto-index a for-loop.
0 Kudos
Message 3 of 10
(3,575 Views)
Hi smercurious,

Thanks so much for that - it did work. The thresholding itself is turning out to be a royal problem though! It seems that the threshold peak detector only gives a boolean output when the threshold is crossed. What I want is that all points in a waveform above the threshold should be passed. For example I want only the portion of a sine wave above 2 volts to be passed, or something like that. Is there a function that would do this? Or do I have to figure out another way to do it? Could you give me an idea as to what I could try?

Thanks again in advance.
0 Kudos
Message 4 of 10
(3,565 Views)
What should the "non-passed" values be? You'll need to better define what you're trying to generate. Are you trying to create a new waveform that consists of just those crests (essentially making a shorter waveform that looks like a bunch of hills), or are you trying to create a waveform that has zero for the locations where the original is below your threshold? Do you have a picture/sketch of what you want to generate based on an input waveform?


Message Edited by smercurio_fc on 05-16-2008 05:26 PM
0 Kudos
Message 5 of 10
(3,562 Views)

What I'm actually trying to do is record evoked biosignals from the body. The square wave I mentioned is the stimulus (auditory - sounds like a "click") which evokes a response. This response is what I'm recording through the soundcard. Now I need to synchronize each square wave with the recording, in that the falling edge of each square wave should be the indication to start acquiring, for a very small fixed duration, from the soundcard. I couldn't figure out how to use the Triggering functions, so I thought if I add the (inverted) square wave and the biosignal, then threshold the summed waveforms - pass whatever portion of the signal is greater than the amplitude of the square - I'd get just the evoked signal.

So what I want to do is acquire, say 100, small waveforms one at a time (which will be stored in a 100-dimensional array). The recording of each waveform would commence in sync with the negative edge of the square wave.

I hope I'm being clear while describing what I need, please do let me know what more information I need to give.

Thanks in advance again. 🙂
0 Kudos
Message 6 of 10
(3,556 Views)
Ok I've tried to create a case structure where if the (square wave + signal) is greater than (square wave), then the summed signal is passed. I've attached the VI i'm working on, could you please check it out and tell me what I'm doing wrong?
0 Kudos
Message 7 of 10
(3,550 Views)
I'm not sure which "Triggering functions" you're referring to. Are you referring to the DAQ triggering functions? Those are only applicable if you're using a DAQ card, and it seems that you're not doing that. All you're doing is generating a sound with the sound card, and reading the sound using the sound card. You will need to set up your own software trigger, and that may not be adequate for your experiment. Is there a maximum amount of time that is allowed before you start the sound acquisition? If there is, you need to be aware that with software-based triggering you cannot guarantee the sound acquisition will occur within that time, especially if that max time is fairly short.

That said, your VI isn't set up to do any kind of synchronization between sound generation and sound acquisition, so everything else you're doing with the signals is moot. You perform a single sound read, and the loop is continuously running. Thus, you could have acquired your sound before you've actually generated anything! is the generation/acquisition supposed to run continuously or for a fixed amount of time, say for 10 seconds or so? This will determine what kind of architecture you need.
0 Kudos
Message 8 of 10
(3,509 Views)

I'm sorry for that. I've spent some time with it and I think I nearly have it done - I've used an event structure inside which a case structure is configured so that nothing happens when it's a rising edge, but all the operations happen when it's a falling edge. I'm comparing NewVal and OldVal so that if NewVal > OldVal it would be a rising edge (this is the "true" case), in which case I do nothing. But when I run it single-step, the parameter controlling the event structure is the amplitude of the square wave, and not the value at that point, which is what I require. What should I change? If you could have a look at the VI I'd be grateful.

Thanks a lot,

Keshav

0 Kudos
Message 9 of 10
(3,470 Views)
I'd provide a suggestion as to what to change if I could actually understand the design of the VI. What is the point of the for loop? You're not actually iterating though the waveform. You're always picking the same point.

Also, the Event Structure is not meant to be used in the way that you're using it. A simple shift register would accomplish the same thing.
0 Kudos
Message 10 of 10
(3,430 Views)