From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Discrete signal recognition from continuous waveform

Hi Folks,

 

I'm hoping some of you can give some general pointers on how to better approach this problem. This is the first application I will be actively performing waveform analysis so forgive the amateurishness. Smiley Happy

 

Anyway I'm acquiring a physiological signal at 50Hz and attempting to recognize 'breaths' from this source. The problem is that the frequency, amplitude, and offset will vary depending on the rate and depth of breath (among other things). Below are the ranges I'm working with (in units of "WC pressure):

 

Freq: 10mHz-500mHz

Amp: 0.005 to 0.145 "WC

Offset: -0.25 to -1.0"WC

 

In general, I'm trying to reliably get a measure on each breath's amplitude (and offset, but that's easy) and frequency. I have tried two methods: to isolate each breath and analyze, or to buffer say 10seconds worth of signal and analyze. The problem mostly comes in when I try to use the "Pulse Measurements" and "Amplitude and Levels" vi's as part of the analysis package. The way in which they perform their calculation relies on set crossing thresholds - if the signal jumps in amplitude or quickly changes frequency (not likely) and I'm using the buffer approach, I lose calculation on the buffer. Obviously using a fixed buffer size (can) give different results depending on the frequency of the signal.

 

It's amazing how we (as humans... right?) can discern the breaths from this signal, how we can easily identify problematic shapes, but to do this programatically, it's a completely different story.

 

I'm just unsure how to better approach this - should i be trying to fit an ideal curve to every group of samples? Attached is a screenshot of ideal (at two distinct rates) and actual.

Message Edited by 8bitbanger on 07-10-2009 02:19 PM
v2009 devel. w/RT
Download All
0 Kudos
Message 1 of 5
(2,700 Views)

Given your wide frequency range and large offset, I think some kind of model fitting may be the best approach.

 

I would probably use a sliding window.  I would subtract the mean or the peak value of the array within the window.  Which one will depend on the type of model.  Fitting to a sine wave seems like an obvious choice, but the fitting routines do not work well if the initial frequency is off or there are multiple cycles in the dataset.  I might try a parabola.  Fits are fast.  Locating the peak is easy.  Checking the residual should indicate whether the fit worked well.  If you have multiple cycles in the segment, a parabola will not fit well.  If the peak of the parabola is outside the segment, the subject is holding his breath.  In either case the size of the segment can be adjusted.

 

If you fit to a parabola, subtract the peak.  If you try to fit to a sine, subtract the mean. 

 

Since the signal frequency is so low, you have plenty of time to fit several different size segments if necessary and still produce results which appear responsive to the operator.

 

Lynn

0 Kudos
Message 2 of 5
(2,671 Views)

First, I would filter out the small quick changes is the waveform (unless they are significant to what you are doing or you consider them to be a  breath).

 

In the past, I have tried to heavily filter respiration down to a sinusoid signal and then take the Hilbert transform to create an analytic signal (f(t) + jH{f(t)}).  Take a look at the derivative of the phase of this signal which is equivalent to its instantaneous frequenc.

 

Take a look at attached.   I saved data into the Data In control for you to use as an example.  This data is monkey respiration, so it is a little faster than human. Play around with the filters to see what is best for your data.  Hopefully, this will be of some help.

Randall Pursley
0 Kudos
Message 3 of 5
(2,666 Views)

Thank you both for your responses - I'm out on business for the next week, but 'will take time for a better response during downtime. 

 

Indeed this is for NHP respiration. I'm suprised it wasn't suggested to fit this to ideal, which appears more like a square wave. The 'ideal' waveform was from a mechanical ventilator FYI.

 

Cheers,

Jamie 

v2009 devel. w/RT
0 Kudos
Message 4 of 5
(2,656 Views)
From what I've seen, 'ideal' respiration never occurs and is very difficult to model that way.  Too many other things can interfere with respiration such as talking, eating, various emotional and physical responses.
Randall Pursley
0 Kudos
Message 5 of 5
(2,624 Views)