On Wednesday, 27 February 2013 21:39:38 UTC, Tim Wescott wrote:> On Wed, 27 Feb 2013 12:30:00 -0800, zoulzubazz wrote: > > > > > On Wednesday, 27 February 2013 18:49:31 UTC, Chris Bore wrote: > > >> On Wednesday, 27 February 2013 14:44:08 UTC, zoulz...@googlemail.com > > >> wrote: > > >> > > >> > hey guys, i am trying to design a filter to extract the signal of a > > >> > beating heart from a voltage response to a 200khz sinusoid i am > > >> > passing though a volunteer.the 200kHz voltage response signal is > > >> > sampled at 2e6 samples per second and the noise levels are around > > >> > 0.8%. what would be the best approach to this problem assuming normal > > >> > heart rate of 72 beats pre minute(1.2Hz)? thanks very much. > > >> > > >> > > >> > > >> I suggest you set a goal for the SNR and distortion you will accept. > > >> Then characterize the signal and the noise with estimates of their > > >> bandwidth. This will then allow you to set a goal for Processing Gain, > > >> which in turn will let you set target Equivalent Noise Band Width > > >> (ENBW) - which in turn is a guesstimate for the required filter > > >> bandwidth. Those lead to estimate of required sample rate. For ADC > > >> resolution you can simply use the standard formula. For distortion you > > >> will need to decide what form of distortion you expect, and possibly > > >> implement multi-band filter as a consequence. > > >> > > >> > > >> > > >> Chris Bore > > >> > > >> BORES Signal Processing > > >> > > >> www.bores.com > > > > > > FYI, the equipment used is certified by relevant ethical bodies. > > > Original idea is to measure impedance of different body parts passing a > > > constant current of around 1mA@200kHz. the voltage response to this > > > current is being recorded to evaluate impedance offline. I designed a > > > low pass IIR filter with a passband set to 100Hz with matlab. After > > > filtering the 200 kHz voltage signal i see a recurring dip which seems > > > to be from a beating heart but wanted some expert advice on filtering > > > this signal out properly for further analysis. Thanks very much. > > > > It is not clear what you are filtering: are you extracting the measured > > impedance at 100kHz, then filtering that with your 100Hz low pass? > > > > Or are you filtering your 100kHz signal and finding some baseband energy > > embedded in it? > > > > -- > > Tim Wescott > > Control system and signal processing consulting > > www.wescottdesign.comthank you vlad Chris, thank you very much for that gives me something to start off with, much appreciated. tim i am trying to extract the a low frequency (heart activity) signal from a 200kHz sinusoid which i am passing through an individual. thanks everyone!
Filtering for heart rate extraction.
Started by ●February 27, 2013
Reply by ●February 27, 20132013-02-27
Reply by ●February 27, 20132013-02-27
On Wed, 27 Feb 2013 12:30:00 -0800, zoulzubazz wrote:> FYI, the equipment used is certified by relevant ethical bodies. > Original idea is to measure impedance of different body parts passing a > constant current of around 1mA@200kHz. the voltage response to this > current is being recorded to evaluate impedance offline. I designed a > low pass IIR filter with a passband set to 100Hz with matlab. After > filtering the 200 kHz voltage signal i see a recurring dip which seems > to be from a beating heart but wanted some expert advice on filtering > this signal out properly for further analysis. Thanks very much.This is probably obvious to you, but since not stated: do you have a "detector" of some kind in your system? As there would be in an AM receiver? And your LPF follows the detector?
Reply by ●February 28, 20132013-02-28
On Wed, 27 Feb 2013 12:30:00 -0800 (PST), zoulzubazz@googlemail.com wrote:> > Original idea is to measure impedance of different body parts passing a constant curr= >ent of around 1mA@200kHz. the voltage response to this current is being rec= >orded to evaluate impedance offline. I designed a low pass IIR filter with = >a passband set to 100Hz with matlab. After filtering the 200 kHz voltage si= >gnal i see a recurring dip which seems to be from a beating heart but wante= >d some expert advice on filtering this signal out properly for further anal= >ysis. Thanks very much.If I understand you correctly you are injecting currents that cause a voltage response much higher than the ECG signals being generated by the heart muscle. So you are looking at an entirely different phenomenon from ECG. For those of you that are still thinking of ECG, consider that a typical ECG signal, directly from the electrodes, is in the range of 1mV to 5 mV. To produce a comparable voltage response to a 1 mA injected current the impedance of the body part being measured would have to be 1 Ohm to 5 Ohms. I don't think it is possible to get such a low impedance connection across any reasonable body part. So I have to believe that the voltage response that you get to a 1 mA injected currect would be orders of magnitude bigger than the ECG signal. So it is, as you said, a measurement of the impedance of the body part. I assume that the first thing you do is amplitude detect for 200 kHz (AM demodulation), preferably detected with a synchronous detector. If you are doing all of this in software then I hope you sampled the 200 kHz clock at the same time you sampled the voltage response signal at 2e6 samples per second. Otherwise you are throwing away a golden opportunity to do synchronous detection and you will be forced to settle for envelope detection, which is not as immune to noise as synchronous detection. If I were you I would do the synchronous AM detection and minimal low-pass filtering in hardware and then sample the resulting filtered amplitude at a much lower sample rate. This hardware low-pass filtere is not critical. It is just to get rid of the 200 kHz carrier. A 10 kHz cutoff would be low enough to get rid of the carrier and still high enough not to affect any heart rate related artifacts in the AM detected signal. So then you could sample at maybe 10,000 samples per second. Now you have finally come to the meat of the problem that you were probably thinking was the main question: How to filter this AM demodulated signal further to extract heart rate information. Since the phenomenon you are investigating is not ECG but is some currently unknown phenomenon whereby the heart activity causes changes in the impedance of some body part, any knowledge of ECG waveforms and bandwidths is totally irrelevant to your quest. You are on your own now. I suggest you play it safe and start your investigations by filtering as little as possible - like say down to 10 times the heart rate frequency - and see what you get. As you discover more about the phenomenon of body part impedance affected by heart activity you may decide that different filtering is necessary. But let me go out on a limb a predict that the major effect on this measured impedance fluctuation will be due to mechanical movement at the site of the electrode connection - causing a better or a worse connection. You won't be measuring anything inherent in the body physiology - just some consequence of your measurement connection - unless you can guarantee that the impedance at the point of connection of the electrode to the body is know to be constant throughout a heart beat. Robert Scott Real-Time Specialties Hopkins, MN
Reply by ●March 19, 20132013-03-19
On Wednesday, 27 February 2013 14:44:08 UTC, zoulz...@googlemail.com wrote:> hey guys, i am trying to design a filter to extract the signal of a beating heart from a voltage response to a 200khz sinusoid i am passing though a volunteer.the 200kHz voltage response signal is sampled at 2e6 samples per second and the noise levels are around 0.8%. what would be the best approach to this problem assuming normal heart rate of 72 beats pre minute(1.2Hz)? thanks very much.Thanky for that detailed reply. much appreciated.
Reply by ●March 19, 20132013-03-19
On Thursday, 28 February 2013 22:53:24 UTC, Robert Scott wrote:> On Wed, 27 Feb 2013 12:30:00 -0800 (PST), zoulzubazz@googlemail.com > > wrote: > > > > > > > > Original idea is to measure impedance of different body parts passing a constant curr= > > >ent of around 1mA@200kHz. the voltage response to this current is being rec= > > >orded to evaluate impedance offline. I designed a low pass IIR filter with = > > >a passband set to 100Hz with matlab. After filtering the 200 kHz voltage si= > > >gnal i see a recurring dip which seems to be from a beating heart but wante= > > >d some expert advice on filtering this signal out properly for further anal= > > >ysis. Thanks very much. > > > > If I understand you correctly you are injecting currents that cause a > > voltage response much higher than the ECG signals being generated by > > the heart muscle. So you are looking at an entirely different > > phenomenon from ECG. For those of you that are still thinking of ECG, > > consider that a typical ECG signal, directly from the electrodes, is > > in the range of 1mV to 5 mV. To produce a comparable voltage response > > to a 1 mA injected current the impedance of the body part being > > measured would have to be 1 Ohm to 5 Ohms. I don't think it is > > possible to get such a low impedance connection across any reasonable > > body part. So I have to believe that the voltage response that you > > get to a 1 mA injected currect would be orders of magnitude bigger > > than the ECG signal. So it is, as you said, a measurement of the > > impedance of the body part. > > > > I assume that the first thing you do is amplitude detect for 200 kHz > > (AM demodulation), preferably detected with a synchronous detector. > > If you are doing all of this in software then I hope you sampled the > > 200 kHz clock at the same time you sampled the voltage response signal > > at 2e6 samples per second. Otherwise you are throwing away a golden > > opportunity to do synchronous detection and you will be forced to > > settle for envelope detection, which is not as immune to noise as > > synchronous detection. If I were you I would do the synchronous AM > > detection and minimal low-pass filtering in hardware and then sample > > the resulting filtered amplitude at a much lower sample rate. This > > hardware low-pass filtere is not critical. It is just to get rid of > > the 200 kHz carrier. A 10 kHz cutoff would be low enough to get rid > > of the carrier and still high enough not to affect any heart rate > > related artifacts in the AM detected signal. So then you could sample > > at maybe 10,000 samples per second. > > > > Now you have finally come to the meat of the problem that you were > > probably thinking was the main question: How to filter this AM > > demodulated signal further to extract heart rate information. Since > > the phenomenon you are investigating is not ECG but is some currently > > unknown phenomenon whereby the heart activity causes changes in the > > impedance of some body part, any knowledge of ECG waveforms and > > bandwidths is totally irrelevant to your quest. You are on your own > > now. I suggest you play it safe and start your investigations by > > filtering as little as possible - like say down to 10 times the heart > > rate frequency - and see what you get. As you discover more about the > > phenomenon of body part impedance affected by heart activity you may > > decide that different filtering is necessary. > > > > But let me go out on a limb a predict that the major effect on this > > measured impedance fluctuation will be due to mechanical movement at > > the site of the electrode connection - causing a better or a worse > > connection. You won't be measuring anything inherent in the body > > physiology - just some consequence of your measurement connection - > > unless you can guarantee that the impedance at the point of connection > > of the electrode to the body is know to be constant throughout a heart > > beat. > > > > Robert Scott > > Real-Time Specialties > > Hopkins, MNHey robert, all the assumtions you made in your reply hold true. unfortunately the signals have been sampled and saved on a computer using a data acquisition device and everything has to be done in software (matlab). in your reply you mention a '200kHz clock' , by this do you mean time stamp of each sample, if yes this can be generated manually in matlab. trying to do envelop detection for now using hilbert transform. thanks very much for your input regarding this.
Reply by ●March 27, 20132013-03-27
On Thursday, 28 February 2013 22:53:24 UTC, Robert Scott wrote:> On Wed, 27 Feb 2013 12:30:00 -0800 (PST), zoulzubazz@googlemail.com > > wrote: > > > > > > > > Original idea is to measure impedance of different body parts passing a constant curr= > > >ent of around 1mA@200kHz. the voltage response to this current is being rec= > > >orded to evaluate impedance offline. I designed a low pass IIR filter with = > > >a passband set to 100Hz with matlab. After filtering the 200 kHz voltage si= > > >gnal i see a recurring dip which seems to be from a beating heart but wante= > > >d some expert advice on filtering this signal out properly for further anal= > > >ysis. Thanks very much. > > > > If I understand you correctly you are injecting currents that cause a > > voltage response much higher than the ECG signals being generated by > > the heart muscle. So you are looking at an entirely different > > phenomenon from ECG. For those of you that are still thinking of ECG, > > consider that a typical ECG signal, directly from the electrodes, is > > in the range of 1mV to 5 mV. To produce a comparable voltage response > > to a 1 mA injected current the impedance of the body part being > > measured would have to be 1 Ohm to 5 Ohms. I don't think it is > > possible to get such a low impedance connection across any reasonable > > body part. So I have to believe that the voltage response that you > > get to a 1 mA injected currect would be orders of magnitude bigger > > than the ECG signal. So it is, as you said, a measurement of the > > impedance of the body part. > > > > I assume that the first thing you do is amplitude detect for 200 kHz > > (AM demodulation), preferably detected with a synchronous detector. > > If you are doing all of this in software then I hope you sampled the > > 200 kHz clock at the same time you sampled the voltage response signal > > at 2e6 samples per second. Otherwise you are throwing away a golden > > opportunity to do synchronous detection and you will be forced to > > settle for envelope detection, which is not as immune to noise as > > synchronous detection. If I were you I would do the synchronous AM > > detection and minimal low-pass filtering in hardware and then sample > > the resulting filtered amplitude at a much lower sample rate. This > > hardware low-pass filtere is not critical. It is just to get rid of > > the 200 kHz carrier. A 10 kHz cutoff would be low enough to get rid > > of the carrier and still high enough not to affect any heart rate > > related artifacts in the AM detected signal. So then you could sample > > at maybe 10,000 samples per second. > > > > Now you have finally come to the meat of the problem that you were > > probably thinking was the main question: How to filter this AM > > demodulated signal further to extract heart rate information. Since > > the phenomenon you are investigating is not ECG but is some currently > > unknown phenomenon whereby the heart activity causes changes in the > > impedance of some body part, any knowledge of ECG waveforms and > > bandwidths is totally irrelevant to your quest. You are on your own > > now. I suggest you play it safe and start your investigations by > > filtering as little as possible - like say down to 10 times the heart > > rate frequency - and see what you get. As you discover more about the > > phenomenon of body part impedance affected by heart activity you may > > decide that different filtering is necessary. > > > > But let me go out on a limb a predict that the major effect on this > > measured impedance fluctuation will be due to mechanical movement at > > the site of the electrode connection - causing a better or a worse > > connection. You won't be measuring anything inherent in the body > > physiology - just some consequence of your measurement connection - > > unless you can guarantee that the impedance at the point of connection > > of the electrode to the body is know to be constant throughout a heart > > beat. > > > > Robert Scott > > Real-Time Specialties > > Hopkins, MNHey guys, Referring to robert's reply, i had a query. now because the input is known to be at 200kHz and is hidden somewhere in the voltage signal being acquired, can the voltage response be bandpass filtered with a FIR filter to isolate the carrier (clock) signal and then synchronous de-modulation be used to extract the AM signal. this is because unfortunately the input clock (carrier) has not been sampled as robert thought would be ideal in this case. thanks very much. best wishes zoul
Reply by ●March 27, 20132013-03-27
On Wed, 27 Mar 2013 17:42:05 -0700 (PDT), zoulzubazz@googlemail.com wrote:> >Hey guys, > >Referring to robert's reply, i had a query. now because the input is known = >to be at 200kHz and is hidden somewhere in the voltage signal being acquire= >d, can the voltage response be bandpass filtered with a FIR filter to isola= >te the carrier (clock) signal and then synchronous de-modulation be used to= > extract the AM signal. this is because unfortunately the input clock (carr= >ier) has not been sampled as robert thought would be ideal in this case. th= >anks very much. > >best wishes >zoulYes, I believe this technique was used in analog AM radio reception many years ago as an upgrade to standard envelope detection. They would run a very narrow band phase-locked loop locked on the carrier to generate a local copy of the carrier. Then they used the reconstructed carrier to synchronously demodulate the AM signal. There is no reason why you could not do that digitally. Plus you have the advantage of not being limited to processing things in natural time order. You can process the data set as a whole to do a better job than a real-time PLL could do. (That is, your PLL can look at both the past and the future while the analog method could only use the past.) However you might have a problem if the 200 kHz carrier is at some times totally missing, or very low. Then your lock on that carrier might not be so solid. A phase error in your reconstructed carrier would cause the synchronously detected signal to be mostly noise. But then envelope detection falls down in exactly the same circumstances, so using synchronous detection with a reconstructed carrier is no worse than envelope detection. Robert Scott Hopkins, MN
Reply by ●April 3, 20132013-04-03
On Thursday, 28 March 2013 02:26:35 UTC, Robert Scott wrote:> On Wed, 27 Mar 2013 17:42:05 -0700 (PDT), zoulzubazz@googlemail.com > > wrote: > > > > > > > >Hey guys, > > > > > >Referring to robert's reply, i had a query. now because the input is known = > > >to be at 200kHz and is hidden somewhere in the voltage signal being acquire= > > >d, can the voltage response be bandpass filtered with a FIR filter to isola= > > >te the carrier (clock) signal and then synchronous de-modulation be used to= > > > extract the AM signal. this is because unfortunately the input clock (carr= > > >ier) has not been sampled as robert thought would be ideal in this case. th= > > >anks very much. > > > > > >best wishes > > >zoul > > > > Yes, I believe this technique was used in analog AM radio reception > > many years ago as an upgrade to standard envelope detection. They > > would run a very narrow band phase-locked loop locked on the carrier > > to generate a local copy of the carrier. Then they used the > > reconstructed carrier to synchronously demodulate the AM signal. > > There is no reason why you could not do that digitally. Plus you have > > the advantage of not being limited to processing things in natural > > time order. You can process the data set as a whole to do a better > > job than a real-time PLL could do. (That is, your PLL can look at > > both the past and the future while the analog method could only use > > the past.) However you might have a problem if the 200 kHz carrier is > > at some times totally missing, or very low. Then your lock on that > > carrier might not be so solid. A phase error in your reconstructed > > carrier would cause the synchronously detected signal to be mostly > > noise. But then envelope detection falls down in exactly the same > > circumstances, so using synchronous detection with a reconstructed > > carrier is no worse than envelope detection. > > > > Robert Scott > > Hopkins, MNHey guys, Thanks very much for your help. this is what has been found so far and any help would be much appreciated,the following two figures show the existence of a phenomenon before filtering and after filtering (note:the signals shown are independently acquired at different times different sampling rate and for different durations but illustrate the phenomenon i am after) http://dl.dropbox.com/u/48735904/hear%20beat%20signal.JPG http://dl.dropbox.com/u/48735904/heart_dips.jpg The signal in picture two was extracted after brute-force filtering the sampled signal originally acquired to measure impedance using the following butterworth filter code in matlab. % All frequency values are in kHz. Fs = 2000; % Sampling Frequency Fpass = 10; % Passband Frequency Fstop = 100; % Stopband Frequency Apass = 1; % Passband Ripple (dB) Astop = 80; % Stopband Attenuation (dB) % Calculate the order from the parameters using BUTTORD. [N,Fc] = buttord(Fpass/(Fs/2), Fstop/(Fs/2), Apass, Astop); % Calculate the zpk values using the BUTTER function. [z,p,k] = butter(N, Fc); % To avoid round-off errors, do not use the transfer function. Instead % get the zpk representation and convert it to second-order sections. [sos_var,g] = zp2sos(z, p, k); Hd = dfilt.df2sos(sos_var, g); ////////////////////////////////////////////////////// Now envelop detection was applied using Hilbert transform with the following code (sampling frequency 2e6)to observe the same phenomenon (please follow code to understand what is hppening). Briefly, signal hilbert transformed; lowpass filtered (wc=~10kHz); downsampled(down by 200 times to 10kSa/Sec); lowpass filtered (wc=~100Hz). Result nothing unlike the filter above which gave me a visual of the dip. Would like your views on this. Thanks very much. %Hilbert transform Nh= 180; % Filter order hhilbert = dsp.FIRFilter('Numerator', firpm(Nh, [0.01 .95],[1 1],'hilbert')); hdelay = dsp.Delay('Length',Nh/2); Fpp =4.375e-3; Fss =5.625e-3; Hf2=fdesign.lowpass('N,Fp,Fst',1345,Fpp,Fss); Hff2 = dsp.FIRFilter('Numerator',get(design(Hf2,'equiripple'),'Numerator')); sige = abs(complex(0, step(hhilbert, data(:,1))) + step(hdelay, data(:,1))); sigenv2 = step(Hff2, sige); %signal downsampled to 10kSa/Sec and then low pass filtered again sigenv3=downsample(sigenv2,200); Hf3=fdesign.lowpass('N,Fp,Fst',300,(100/10e3),(250/10e3)); Hff3=dsp.FIRFilter('Numerator',get(design(Hf3,'equiripple'),'Numerator')); sigenv4 = step(Hff3, sigenv3); plot(sigenv4);
Reply by ●April 3, 20132013-04-03
zoulzubazz@googlemail.com wrote:> [*SNIP*] > > Thanks very much for your help. this is what has been found so far and any help would be much appreciated,the following two figures show the existence of a phenomenon before filtering and after filtering (note:the signals shown are independently acquired at different times different sampling rate and for different durations but illustrate the phenomenon i am after) > > http://dl.dropbox.com/u/48735904/hear%20beat%20signal.JPGI don't think that plot _COULD_ match the assumptions the OP has either stated or implied. [My "Signals and Systems" courses predated Cooley and Tukey. When, as an undergrad, I was an electronics tech for the university's Veterinary Physiology department they they had a visiting professor who had no problem continuing his research using a smoke kymograph(sp?) when the current post-docs had preempted all the available 'modern' equipment - IIRC he was reputed to have gotten the better data.] If I understand the OP's description correctly, he is describing his experimental subject as a Linear 2-Port Passive Network with an unspecified number of internal nodes. He seems to be assuming that an "external process" [ie.g. a beating heart] modulates a "transfer impedance". If so, why are D.C. effects visible? ?? ??? *NOTE BENE* !!!!!!!!!!!!!!!!! I not suggesting that OP's work is ???/****/%%% ;/ I am suggesting that model respecification may be in order.
Reply by ●April 3, 20132013-04-03
>nodes. He seems to be assuming that an "external process" >[ie.g. a beating heart] modulates a "transfer impedance". > >If so, why are D.C. effects visible? ?? ??? > >*NOTE BENE* !!!!!!!!!!!!!!!!! >I not suggesting that OP's work is ???/****/%%% ;/ >I am suggesting that model respecification may be in order.I agree that the model could use some development, but I think you answered your own question. By modulating the impedance of the system, it is no longer LTI. Depending on how the modulation works, it could make total sense that the signal would have a DC component.






