Presentation is loading. Please wait.

Presentation is loading. Please wait.

ES97H Biomedical Signal Processing

Similar presentations


Presentation on theme: "ES97H Biomedical Signal Processing"— Presentation transcript:

1 ES97H Biomedical Signal Processing
Lecturer: Dr Igor Khovanov Office: D207 Syllabus: Biomedical Signal Processing. Examples of signals. Linear System Analysis. Laplace Transform. Transfer Function.   Frequency Response. Fourier Transform. Discrete Signal Analysis. Digital (discrete-time) systems. Z-transform. Filtering. Analogue Filters design and application. Case Study.

2 Envelope Extraction Problem: Estimate EMG activity to airflow during inspiration. The intricate variations in the EMG signal in the signal are often not of interest. A measure of the total or integrated electrical activity, ideally reflecting the global activity in the pool of active motor units of the muscle, would serve the purposes of most analyses. The smoothed envelope of the EMG signal is commonly used under these circumstances.

3 Envelope Extraction Approach 1. The filters commonly used for calculation of the envelope. Consider the digital signal xi Step 1. Calculation of the rectified signal |xi| Step 2. Selection of an appropriate low-pass filter to severely attenuate high frequencies, and filter the rectified signal

4 Envelope Extraction via low-pass filtering
Matlab Script: Plot the rectified signal |xi| close all;clear all; % load the signal fs=10000; % Sampling frequency;... Ts=1/fs; % Sampling period fn=fs/2; % Nyquist frequency dinput=load('emg2.dat'); signal=abs(dinput(:,1)); Ns=length(signal); time=[0:1:(Ns-1)]*Ts; figure(1) % plot the signal hold on % to draw next plot in the same figure plot(time,signal,'-b','linewidth',1) grid on; box on; hold on; xlabel(' \it t, [sec] ','fontname','times','fontsize',24); ylabel('\it EMG, [\mu V] ','fontname','times','fontsize',24);

5 Envelope Extraction via low-pass filtering
Matlab Script: Plot the rectified signal |xi|

6 Envelope Extraction via low-pass filtering
Matlab Script: Estimate the spectrum of the rectified signal |xi| % Calculate FFT xfft=fft(signal); % complex coefficient of Fourier transform p=abs(xfft(1:Ns/2))/Ns*2; % amplitude for positive frequencies only freq=[0:Ns/2-1]/(Ns/2)*fn; % frequencies, for which FFT was applied %%%%% Plot the amplitude spectrum f2=figure(2); movegui(f2, 'northwest'); %semilogy(freq,p,'-m') loglog(freq,p,'-b') hold on grid on box on xlabel ('frequency, f, Hz'); % x label ylabel ('Amplitude spectrum'); % y label

7 Envelope Extraction via low-pass filtering
Matlab Script: Estimate the spectrum of the rectified signal |xi|

8 Envelope Extraction via low-pass filtering
Matlab Script: Design the filter (Butterworth) % Design filter wcutoff=5; wn=wcutoff/(fs/2); filtorder=5; [b1,a1]=butter(filtorder,wn); %[b1,a1]=ellip(filtorder,3,60,wn); % plot the frequency response of the filter (on the same plot as signal sppectrum) [G1z,wT]=freqz(b1,a1,16384); freqf=wT/(2*pi*Ts); loglog(freqf,abs(G1z)*pmax,'--r');

9 Envelope Extraction via low-pass filtering
Matlab Script: Design the filter (Butterworth)

10 Envelope Extraction via low-pass filtering
Matlab Script: Apply the filter % perform filtering by FILTFILT s2=filtfilt(b1,a1,signal); %%%% Calculate and plot FFT xfft=fft(s2); % complex coefficient of Fourier transform p=abs(xfft(1:Ns/2))/Ns*2; % amplitude for positive frequencies only loglog(freq,p,'-k') figure(1) plot(time,s2,'-k','linewidth',2)

11 Envelope Extraction via low-pass filtering
Matlab Script: Apply the filter (Butterworth)

12 Envelope Extraction via low-pass filtering
Matlab Script: Apply the filter (Elliptic)

13 Envelope Extraction or Matlab script Matlab script
Approach 2. Moving average technique can be used for calculation of the envelope. Consider the digital signal xi Step 1. Calculation of the rectified signal |xi| Step 2. Selection of an appropriate window length, M, and application of the window or Matlab script % Moving Average Window with the centre % at a given time moment for k=1:Ns, % consider each time moment k1=k-iwin; if k1<1, k1=1; end k2=k+iwin; if k2>Ns,k2=Ns;end xx=signal(k1:k2); mx1(k)=mean(xx); end plot(time,mx1,'-k','linewidth',2); Matlab script % Moving Average Window for k=1:Ns, % consider each time moment, % form a window and average k2=k+iwin; if k2>Ns, k2=Ns; end xx=signal(k:k2); mx(k)=mean(xx); plot(time,mx,'-r','linewidth',2);

14 Envelope Extraction or
Approach 2. Moving average technique can be used for calculation of the envelope. Consider the digital signal xi Step 1. Calculation of the rectified signal |xi| Step 2. Selection of an appropriate window length, M, and application of the window or

15 In Matlab there is a function y=hilbert(x) xH=Imag(y);
Envelope Extraction Approach 3. The envelogram via Hilbert transform Consider the digital signal xi Step 1. Calculate Hilbert transform xH (below we use notations for continuous signals) To form an analytical signal Then the signal x(t) can be presented as Where the amplitude and phase are coming from the analytical signal Step 2. Calculate the amplitude of the analytical signal a(t) (i.e. |y(t)|), which is the estimated envelope. In Matlab there is a function y=hilbert(x) xH=Imag(y);

16 Examples of Hilbert transform
Amplitude modulation.

17 Examples of Hilbert transform
Frequency (phase) modulation.

18 Envelope Extraction via Hilbert Transform
Matlab script: %Approach Envelope extraction by Hilbert transform asignal=hilbert(signal); signalH=imag(asignal); ampHilbert = sqrt((signal.^2)+(signalH.^2)); plot(time,ampHilbert,'-k') title(' Envelope extraction via Hilbert transform','fontname','Times','fontsize',12);


Download ppt "ES97H Biomedical Signal Processing"

Similar presentations


Ads by Google