0% found this document useful (0 votes)
6 views25 pages

BSP LAB Report 5 final

This lab report focuses on analyzing ECG and EMG signals using Empirical Mode Decomposition (EMD), Continuous Wavelet Transform (CWT), and Frequency Domain Methods to extract features and improve signal interpretation. The study aims to compare the effectiveness of these methods in detecting physiological changes and abnormalities in biomedical diagnostics. Key techniques discussed include EMD for noise reduction, CWT for time-frequency analysis, and Frequency Domain Analysis for identifying dominant frequency components.

Uploaded by

201918.bme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views25 pages

BSP LAB Report 5 final

This lab report focuses on analyzing ECG and EMG signals using Empirical Mode Decomposition (EMD), Continuous Wavelet Transform (CWT), and Frequency Domain Methods to extract features and improve signal interpretation. The study aims to compare the effectiveness of these methods in detecting physiological changes and abnormalities in biomedical diagnostics. Key techniques discussed include EMD for noise reduction, CWT for time-frequency analysis, and Frequency Domain Analysis for identifying dominant frequency components.

Uploaded by

201918.bme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

BME 3204 LAB REPORT 05

Lab Title:

Analysis of ECG and EMG Signals Using Empirical Mode Decomposition (EMD),
Continuous Wavelet Transform (CWT), and Frequency Domain Methods

Abstract

This study aims to analyze Electrocardiogram (ECG) and Electromyogram (EMG) signals
using Empirical Mode Decomposition (EMD), Continuous Wavelet Transform (CWT), and
Frequency Domain Methods. These advanced signal processing techniques were employed to
extract features, analyze the time-frequency characteristics, and improve the overall
interpretation of the signals. The methods were compared for their ability to reveal hidden
patterns, noise reduction, and their application in biomedical diagnostics, particularly for
detecting abnormalities in ECG and assessing muscle activity in EMG.

Objectives:

1. Apply Empirical Mode Decomposition (EMD) to analyze ECG and EMG signals by
extracting intrinsic mode functions (IMFs) for feature identification and noise
reduction.
2. Perform Continuous Wavelet Transform (CWT) for time-frequency analysis, enabling
the detection of transient signal features and frequency variations over time.
3. Conduct Frequency Domain Analysis using Fourier Transform to identify dominant
frequency components and evaluate their significance in biomedical signal
interpretation.
4. Compare the effectiveness of EMD, CWT, and frequency domain methods in detecting
physiological changes, such as ECG variations before and after exercise.
5. Utilize statistical analysis techniques to compute mean, standard deviation, skewness,
and kurtosis, providing insights into the variability and distribution of signals.

I. INTRODUCTION

A. Empirical mode decomposition (EMD):

Empirical mode decomposition (EMD) is a data-adaptive multiresolution technique to


decompose a signal into physically meaningful components. EMD can be used to analyze non-
linear and non-stationary signals by separating them into components at different resolutions.

Page | 60
BME 3204 LAB REPORT 05

Some of the common applications of empirical mode decomposition are in the fields of bearing
fault detection, biomedical data analysis, power signal analysis, and seismic signals.

Key Concepts of EMD:

1. Intrinsic Mode Functions (IMFs):

IMFs are the components resulting from the EMD process. Each IMF is a simple oscillatory
mode that represents a specific time-scale of the original signal.

An IMF must satisfy two conditions:

a. The number of extrema (local maxima and minima) and the number of zero-crossings
must be either equal or differ at most by one.
b. Mean of the upper and lower envelopes, which are interpolated from the local maxima
and minima of the signal, must be zero at all points.

Decomposition Process:

The signal is iteratively decomposed into IMFs using a sifting process:

a. Identify the local maxima and minima of the signal.


b. Interpolate the upper and lower envelopes that connect these maxima and minima.
c. Subtract the mean of the upper and lower envelopes from the signal.
d. Repeat the process on the residual until the signal satisfies the IMF conditions.

This process is applied iteratively to obtain all the IMFs and the residual (a trend or a low-
frequency component) left after all IMFs have been extracted.

2. Residual:

The residual is the final component that cannot be further decomposed into IMFs. It typically
represents the trend or the low-frequency component of the original signal.

3. Time-Frequency Representation:

EMD provides a time-frequency representation of the signal. Each IMF captures a specific
scale of oscillations, and the method is particularly effective in analyzing signals with time-
varying frequency content (non-stationary signals).

Page | 61
BME 3204 LAB REPORT 05

B. Applications of EMD:

1. Biomedical Signal Processing: In EEG and ECG analysis, EMD can separate high-
frequency noise from the low-frequency signals and extract relevant features from the
data, especially when the signals are non-stationary.

2. Seismic and Vibration Analysis: EMD is often used in vibration analysis to isolate
different frequency components of a vibration signal, helping in detecting faults in
mechanical systems.

3. Non-linear and Non-stationary Time Series: EMD is highly effective for non-
stationary time series data like financial data, speech signals, and physiological
signals, where traditional Fourier-based methods might fail.

4. Noise Reduction: EMD can help in separating noise from the signal by decomposing
the data into IMFs and then filtering out high-frequency IMFs that correspond to noise.

C. The Continuous Wavelet Transform (CWT)

The Continuous Wavelet Transform (CWT) is a mathematical technique used to analyze


signals, particularly for time-frequency analysis. It is a more flexible approach than the
traditional Fourier Transform because it provides both time and frequency information,
allowing for the identification of transient features in a signal. In the CWT, the signal is
convolved with a wavelet function, which is a small wave-like oscillation that has good
localization in both time and frequency. The wavelet function is scaled and translated to cover
the entire signal, giving a representation of the signal at various resolutions.

It is based on a wavelet function, which is a small, localized wave-like function, that is stretched
or compressed and shifted across the signal. The shifted and stretched version of a mother
wavelet function ψ∈L2(R) is defined by ψa,b(t), where a∈R∖{0} and b∈R and L2 is a Hilbert
space (complete linear space with scalar product), as:

1 𝑡−𝑏
ψa,b(t)=√𝑎 ψ ( )
𝑎

The CWT of a signal x∈L2(R) is defined as:

1 ∞ 𝑡−𝑏
Wx(a,b)=⟨x,ψa,b⟩= √𝑎 ∫−∞ 𝑥(𝑡)ψ *( 𝑎
)dt

Page | 62
BME 3204 LAB REPORT 05

where ψ∗ denotes the complex conjugate of ψ and ⟨⋅,⋅⟩ the scalar product of two functions. The
CWT essentially provides a time-scale representation of the signal, revealing information about
its frequency content at different time points.

D. CWT in ECG Signals

The Continuous Wavelet Transform (CWT) applied to ECG signals gives a time-
frequency representation, which allows you to observe the changes in frequency content of the
signal over time. This is particularly useful for analyzing non-stationary signals like ECG,
where the frequency content can vary over time due to different heart rhythms or abnormalities.

Key Features of CWT in ECG:

1. Time-Frequency Analysis: CWT enables the detection of different frequency


components within the ECG signal at different times. This is useful in identifying
transient features such as P waves, QRS complexes, and T waves, which may be subtle
and hard to spot using just a time-domain analysis.

2. Detection of Abnormalities: In ECG signal analysis, CWT can help detect


abnormalities like arrhythmias or other irregularities. The time-frequency
representation can highlight unusual patterns in the frequency content, helping
clinicians or automated systems in diagnosing heart conditions.

3. Multiresolution Analysis: The CWT provides high resolution for transient, high-
frequency components (such as noise or sharp changes) and low resolution for low-
frequency components. This adaptability in resolution is especially useful for ECG
signals, where high-frequency components like T waves and QRS complexes need
high resolution, and slower changes like heart rate require a lower resolution.

4. Wavelet Selection: In ECG, the choice of wavelet function is important. The Morlet
wavelet is popular for time-frequency analysis because it provides a good balance
between time and frequency localization, making it suitable for ECG signals.

5. Event Detection: The CWT can highlight the temporal evolution of various
waveforms, such as the QRS complex. By analyzing the CWT, one can better
understand the relationships between different parts of the ECG cycle.

Page | 63
BME 3204 LAB REPORT 05

Applications:

1. Heart Rate Variability (HRV) Analysis: By examining the low-frequency and high-
frequency bands in the CWT, you can analyze autonomic nervous system activity,
which is important in stress testing and detecting heart conditions.

2. Arrhythmia Detection: Variations in frequency content (such as a shift in the


predominant frequency bands or irregular waveforms) can indicate arrhythmic
behavior.

3. Feature Extraction: You can extract relevant features from different frequency bands
for classification tasks. For example, if you're designing a classifier to detect heart
disease, the CWT can provide rich features for the algorithm.

E. Frequency Domain Analysis

Frequency Domain Analysis is a technique used to analyze signals in terms of their


frequency components rather than their time-domain characteristics. It is particularly useful for
understanding periodic behaviors, identifying dominant frequencies, filtering, and extracting
features from signals, especially in the context of signal processing.

Key Concepts in Frequency Domain Analysis:

1. Fourier Transform:

➢ The most common method used to perform frequency domain analysis is the
Fourier Transform (FT), which converts a time-domain signal into its
frequency components. The Discrete Fourier Transform (DFT) and its
computationally efficient version, the Fast Fourier Transform (FFT), are
widely used for discrete signals.

➢ The Fourier Transform breaks down a complex signal into a sum of sinusoidal
waves (sine and cosine functions), each characterized by a specific frequency,
amplitude, and phase.

2. Fast Fourier Transform (FFT):

➢ The FFT is an algorithm that computes the DFT efficiently. It transforms a


time-domain signal into its corresponding frequency-domain representation.

Page | 64
BME 3204 LAB REPORT 05

➢ The result of the FFT is a complex-valued sequence, where the magnitude


represents the amplitude of a particular frequency, and the phase represents the
relative shift of that frequency component.

3. Magnitude Spectrum:

➢ After applying the FFT, the magnitude spectrum can be obtained by taking the
absolute value of the complex FFT output. This shows the relative strength or
amplitude of the different frequency components in the signal.

➢ The magnitude spectrum typically highlights which frequencies dominate the


signal.

4. Power Spectrum:

➢ The power spectrum is related to the magnitude spectrum but gives a measure
of the power contained in each frequency component. It is usually calculated as
the square of the magnitude.

➢ The Power Spectral Density (PSD) is a normalized version of the power


spectrum that describes how power is distributed across frequencies.

5. Frequency Resolution:

➢ The frequency resolution of the FFT depends on the length of the input signal
and the sampling rate. A longer signal or higher sampling rate results in finer
frequency resolution.

Applications of Frequency Domain Analysis:

1. Signal Processing: Filtering out noise, enhancing certain features, or detecting


periodicity in the data.

2. Speech Processing: Identifying phonemes or speech features that correspond to


different frequency ranges.

3. Biomedical Signal Analysis: For example, analyzing EEG, ECG, or EMG signals to
detect patterns in different frequency bands (e.g., delta, theta, alpha, beta bands in
EEG).

4. Audio Processing: Analyzing musical notes, pitch, and harmonics.

Page | 65
BME 3204 LAB REPORT 05

III. METHODOLOGY

Lab Work 1: Empirical Mode Decomposition (EMD) of ECG Signal

Solution:

Empirical Mode Decomposition (EMD) is a data-driven method used for analyzing non-
linear and non-stationary signals. It decomposes a signal into a set of intrinsic mode functions
(IMFs), each representing a simple oscillatory mode. This report demonstrates the application
of EMD on an ECG signal, visualizes its IMFs, and reconstructs the original signal for
verification. The aim is to analyze the signal’s components and validate the decomposition-
reconstruction process.

Procedure:

1. Signal Loading and Initialization – The ECG signal is loaded from a .mat file, and
the first column is extracted as the raw signal. The sampling frequency is set to 1070
Hz, and a time vector is generated for time-domain representation.
2. Preprocessing and Parameter Setup – The total number of data points is determined,
and the required parameters for signal analysis are initialized to ensure accurate
decomposition and visualization.
3. Empirical Mode Decomposition (EMD) Application – The ECG signal is
decomposed into intrinsic mode functions (IMFs) using EMD, which adaptively
separates oscillatory components in different frequency bands, aiding in the analysis of
non-linear and non-stationary signals.
4. IMF Visualization and Analysis – Each extracted IMF is plotted against time to
examine its frequency characteristics and signal distribution, helping in understanding
the contribution of different modes.
5. Signal Reconstruction from IMFs – The original ECG signal is reconstructed by
summing all IMFs, ensuring that the decomposition preserves the primary features of
the signal while allowing for component-wise analysis.
6. Reconstruction Assessment and Validation – The reconstructed signal is plotted
separately and compared with the original ECG to evaluate decomposition accuracy,
signal preservation, and potential loss of information.

Page | 66
BME 3204 LAB REPORT 05

Code Implementation in MATLAB:

clc; clear all;close all; ylabel('Amplitude');


ecg=load('Ricky N-L05.mat' title('EMD Segment 4')
);
ecg=ecg.data(:,1);
subplot (7,1,5);
fs=1070;
plot(t,emd_seg(:,5));
N=length(ecg);
xlabel('second');
t=[0:N-1]/fs;
ylabel('Amplitude');
emd_seg=emd(ecg);
title('EMD Segment 5')

figure(1)
subplot (7,1,6);
subplot(7,1,1);
plot(t,emd_seg(:,6));
plot(t,emd_seg(:,1));
xlabel('second');
xlabel('second');
ylabel('Amplitude');
ylabel('Amplitude');
title('EMD Segment 6')
title('EMD Segment 1')

subplot (7,1,7);
subplot(7,1,2);
plot(t,emd_seg(:,7));
plot(t,emd_seg(:,2));
xlabel('second');
xlabel('second');
ylabel('Amplitude');
ylabel('Amplitude');
title('EMD Segment 7')
title('EMD Segment 2')

total_signal=(emd_seg(:,1)
subplot (7,1,3);
+emd_seg(:,2)+
plot(t,emd_seg(:,3));
emd_seg(:,3)
xlabel('second');
+emd_seg(:,4)+emd_seg(:,5)
ylabel('Amplitude');
+emd_seg(:,6)+emd_seg(:,7));
title('EMD Segment 3')
figure(2)
plot(t,total_signal);
subplot (7,1,4);
xlabel('second');
plot(t,emd_seg(:,4));
ylabel('Amplitude');
xlabel('second');
title('Reconstructed Signal')

Page | 67
BME 3204 LAB REPORT 05

IV. RESULTS OF LAB WORK 1

OUTPUT: EMD SEGMENTS OF NORMAL ECG SIGNAL

Figure 1: Decomposed IMFs obtained from the normal ECG signal using Empirical Mode Decomposition (EMD)

This figure shows the intrinsic mode functions (IMFs) extracted from a normal ECG signal.
The IMFs represent oscillatory components at different frequency bands, where higher IMFs
capture fine details and noise, while lower IMFs retain the fundamental ECG waveform.

Page | 68
BME 3204 LAB REPORT 05

OUTPUT: EMD SEGMENTS OF ECG SIGNAL AFTER EXERCISE:

Figure 2: Decomposed IMFs obtained from the ECG signal recorded after exercise using Empirical Mode Decomposition

This figure presents the IMFs derived from an ECG signal recorded after physical activity. It
highlights changes in frequency components due to increased heart rate, where high-frequency
IMFs capture rapid variations, and lower IMFs represent overall waveform trends.

Page | 69
BME 3204 LAB REPORT 05

OUTPUT: EMD SEGMENTS OF EMG SIGNAL

Figure 3: Decomposed IMFs obtained from the EMG signal recorded using Empirical Mode Decomposition

This figure presents the IMFs derived from an EMG signal recorded during muscle contraction.
It highlights changes in frequency components due to muscle activation, where high-frequency
IMFs capture rapid variations associated with motor unit firing, and lower IMFs represent the
overall signal envelope and muscle activation trends.
Page | 70
BME 3204 LAB REPORT 05

OUTPUT: RECONSTRUCTED ECG SIGNAL OF NORMAL ECG SIGNAL

Figure 4: Normal ECG signal reconstructed from IMFs after applying EMD.

This figure compares the reconstructed ECG signal with the original. It highlights the
effectiveness of EMD in preserving the essential features while filtering out unwanted noise.

OUTPUT: RECONSTRUCTED ECG SIGNAL AFTER EXERCISE

Figure 5: After exercise ECG signal reconstructed from IMFs after applying EMD.

This figure compares the reconstructed ECG signal with the original after exercise. It
demonstrates how EMD effectively retains critical signal features while removing noise.
Page | 71
BME 3204 LAB REPORT 05

OUTPUT: RECONSTRUCTED EMG SIGNAL

Figure 6: EMG signal reconstructed from IMFs after applying EMD.

This figure compares the reconstructed EMG signal with the original. It highlights the
effectiveness of EMD in preserving the essential features while filtering out unwanted noise.

Discussion:

1 EMD Segments (IMFs)

The decomposition process resulted in 7 IMFs. Each IMF represents an oscillatory mode with
a distinct frequency characteristic. These IMFs were plotted, and the following observations
were made:

➢ The higher frequency IMFs (IMFs 6 and 7) capture the finer details of the ECG
waveform, including rapid oscillations and noise.

➢ The lower frequency IMFs (IMFs 1, 2, and 3) capture the overall trend of the ECG
signal, including the main components such as the PQRST waves.

➢ The intermediate IMFs (IMFs 4 and 5) capture the transitions between high and low-
frequency oscillations.

2 Reconstructed Signal

The reconstructed signal, obtained by summing all 7 IMFs, showed a high degree of similarity
with the original ECG signal. The following observations were made:

Page | 72
BME 3204 LAB REPORT 05

➢ The reconstructed signal successfully approximated the original signal, with some
small differences that could be attributed to noise or incomplete decomposition.

➢ The overall shape, amplitude, and periodicity of the ECG waveform were preserved in
the reconstructed signal.

Key points observed:

1. Successful Decomposition of ECG Signal:

The application of Empirical Mode Decomposition (EMD) effectively decomposed the ECG
signal into multiple Intrinsic Mode Functions (IMFs), each representing different oscillatory
modes with varying frequency characteristics. The decomposition allowed for the separation
of low-frequency trends (e.g., PQRST waves) and high-frequency noise components,
highlighting EMD's ability to handle non-stationary and non-linear signals.

2. Signal Reconstruction Quality:

By summing the IMFs, the original ECG signal was successfully reconstructed with minimal
loss of key characteristics such as shape, amplitude, and periodicity. This demonstrated the
capability of EMD to preserve the integrity of the signal during the decomposition process,
making it a reliable method for signal analysis.

3. Challenges with Mode Mixing and Noise:

Despite the overall success, minor discrepancies were observed between the original and
reconstructed signals due to mode mixing (when different frequency components overlap in a
single IMF) and noise. These issues indicate areas where EMD can be refined to improve
decomposition accuracy, especially in the higher-frequency IMFs.

4. Effectiveness of EMD in ECG Analysis:

EMD proved to be an effective tool for ECG signal analysis, offering advantages over
traditional methods by providing localized, adaptive decomposition of the signal. It is
particularly useful for tasks like noise reduction, feature extraction, and enhancing signal
clarity, which are important for accurate healthcare diagnostics.

Page | 73
BME 3204 LAB REPORT 05

Lab Work 2: Time-Frequency Analysis of ECG Signals using Continuous Wavelet


Transform (CWT)

Solution:

In this experiment, we analyze an Electrocardiogram (ECG) signal using the Continuous


Wavelet Transform (CWT). The goal is to examine the frequency content of the ECG signal
across different time scales to capture features such as heart rate and arrhythmias. CWT is
chosen because of its ability to provide both time and frequency domain information, making
it ideal for non-stationary signals like ECG.

Basic Algorithm:

This code snippet processes the ECG signal using a Continuous Wavelet Transform (CWT)
and plots its frequency amplitude representation. Below is an explanation of the algorithm and
the steps involved:

Step1: Load ECG Data:

1. Load ECG data from the .mat file (Ricky N-L05.mat).


2. Extract the first column of data (ecg.data(:,1)), which represents the ECG signal.

Step 2: Set Parameters:

3. Define the sampling frequency Fs = 1070 Hz.


4. Calculate the length of the ECG signal N and create a time vector t based on the length
and sampling frequency.

Step 3: Perform Continuous Wavelet Transform (CWT):

5. Define the signal length (signalLength = length(ecg)).


6. Create a CWT filter bank using cwtfilterbank with the specified signal length and
sampling frequency (Fs). The parameter 'VoicesPerOctave', 48 defines the number of
voices per octave for frequency resolution.
7. Use the wt method of the filter bank to compute the wavelet transform (wt) of the ECG
signal.

Step 4: Plot the CWT Result:

8. Plot the absolute values of the wavelet transform (abs(wt)) against the time vector t to
visualize the frequency-amplitude representation of the signal.

Page | 74
BME 3204 LAB REPORT 05

9. Add labels for the x-axis (time in seconds) and y-axis (frequency amplitude), and
provide a title for the plot ("CWT Waveform").

Step 5: Visualize the Output:

10. Visualize the output graph for further analysis

Corresponding MATLAB Code:

clc; clear all;close all;


ecg=load(' Ricky N-L05.mat')'
ecg=ecg.data(:,1);

Fs = 1070;
N = length(ecg);
t = (0:N-1)/Fs;

% Perform EMD
signalLength = length(ecg);

%fb = cwtfilterbank('SignalLength', signalLength,


'Sampling Frequency, Fs);

fb = cwtfilterbank('SignalLength', signalLength,
'SamplingFrequency', Fs, 'VoicesPerOctave',48);
[wt,~] = fb.wt(ecg);

plot(t, abs(wt));
xlabel('second');
ylabel('Frequency Amplitude');
title('CWT Waveform')

Page | 75
BME 3204 LAB REPORT 05

V. RESULTS OF LAB WORK 2

Figure 7: Continuous Wavelet Transform of ECG signal of the Subject “Ricky” in normal condition

Figure 8: Continuous Wavelet Transform of ECG Signal of the Subject “Ricky” after exercise

Page | 76
BME 3204 LAB REPORT 05

Figure 9: Continuous Wavelet Transform of EMG Signal of the Subject “Ricky”

These plots show the time-frequency distribution of the ECG signal in normal and after
exercise conditions and of an EMG signal. The x-axis represents time in seconds, and the y-
axis represents the amplitude of the signal at different frequencies. The plot provides insights
into how the frequency components of the ECG signal evolve over time.

Discussion:

1. Time-Frequency Representation:

The CWT decomposition revealed key frequency components of the ECG signal, such as low-
frequency components associated with the heart's rhythm and higher frequencies potentially
corresponding to noise or other signal artifacts. This representation allows for detailed analysis
of the signal’s variations over time.

2. Multi-Resolution Analysis:

CWT offers multi-resolution analysis, enabling the identification of fine details at high
frequencies and broader trends at lower frequencies. This is particularly useful for detecting
transient events, such as the PQRST waves in ECG, which have varying frequency
characteristics.

Page | 77
BME 3204 LAB REPORT 05

3. Computational Complexity and Interpretation:

While CWT provides richer information than Fourier Transform, it is computationally more
intensive. Proper interpretation of the results requires understanding the scale-frequency
relationship, and adjustments to parameters like the number of voices per octave or wavelet
type may be necessary for different applications.

Comparative Analysis of ECG in Normal and After Exercise Conditions

1. Time-Frequency Representation (CWT Analysis)

➢ Normal ECG:

The CWT of the normal ECG showed a stable frequency distribution with dominant
low-frequency components, indicating a steady heart rhythm. The amplitude of
frequency components was consistent, with well-defined QRS complexes and minimal
variations over time.

➢ ECG After Exercise:

After exercise, the ECG displayed an increase in high-frequency components, reflecting


a faster heart rate. The QRS complexes became more frequent, and the time-frequency
representation showed increased density, indicating the heart’s response to physical
exertion.

2. Frequency Distribution and Signal Characteristics

➢ Normal ECG:

The normal ECG had a balanced frequency spectrum dominated by low-frequency


components, typical of sinus rhythm. The signal was smooth with minimal variability
and a heart rate within the normal resting range.

➢ ECG After Exercise:

After exercise, the frequency spectrum expanded with more high-frequency


components. The heart rate increased, reducing RR intervals, and the waveform showed
sharper peaks, indicating faster depolarization and repolarization.

Page | 78
BME 3204 LAB REPORT 05

Lab works 03: Statistical Analysis and Frequency Domain Representation of Signal Data

Solution:

This experiment focuses on statistical and frequency domain analysis of a signal dataset.
Key statistical parameters, including mean, standard deviation, skewness, and kurtosis, are
computed to describe the signal's distribution and variability. Additionally, the energy and
power of the signal are determined to assess its strength. The frequency components of the
signal are extracted using the Fast Fourier Transform (FFT) to analyze its spectral
characteristics.

Basic Algorithm:

This code processes a signal (x) loaded from a text file (Rayhan-L01.txt) and computes
several statistical and spectral features. Below is a breakdown of the algorithm and its steps:

Step 1: Load the Signal Data:

1. Load the data from the file 'Rayhan-L01.txt' into the variable x.
2. Calculate the length of the signal x with len = length(x).

Step 2: Compute Statistical Features:

3. Mean: m = mean(x) — Calculate the mean of the signal x.


4. Standard Deviation: s = std(x) — Compute the standard deviation of the signal.
5. Skewness: sk = skewness(x) — Compute the skewness of the signal, which measures
the asymmetry of the signal distribution.
6. Kurtosis: k = kurtosis(x) — Compute the kurtosis, which measures the "tailedness" or
sharpness of the signal distribution.
7. Energy: energy = (norm(x)^2) — Compute the energy of the signal, defined as the
squared norm (sum of squares of the signal values).
8. Power: power = norm(abs(x).^2) / len — Calculate the average power of the signal by
computing the mean of the squared absolute values.

Step 3: Frequency Domain Representation:

9. FFT (Fast Fourier Transform): freq = fft(x) — Perform the Fast Fourier Transform
to convert the signal from the time domain to the frequency domain.
10. Plot the magnitude of the frequency components abs(freq) to visualize the frequency
spectrum.

Page | 79
BME 3204 LAB REPORT 05

Step 4: Plotting:

11. The code uses plot(abs(freq)) to plot the absolute value of the FFT result, showing the
frequency spectrum.
12. Labels for the plot are set with xlabel('a') and ylabel('b'), and the title is set to 'c'. These
labels can be modified to be more descriptive.

Step 5: Visualize the Output:

1. Visualize the output graph for further analysis

Corresponding MATLAB Code:

clc;
clear all;
close all;
x=load('Rayhan-L01.txt');

len=length(x)
m=mean(x)
s=std(x)
sk=skewness(x)
k=kurtosis(x)
energy=(norm(x)^2)

power=norm(abs(x).^2)/len
freq=fft(x);
plot(abs(freq));
xlabel('a');
ylabel('b');
title('c');

Limitations (*):

The Fourier Transform of the ECG signals acquired from six subjects did not show any viable
or clear graph. Therefore, we were unable to include them in this lab report to represent their
frequency components.

Page | 80
BME 3204 LAB REPORT 05

VI. RESULTS OF LAB WORK 3

SUBJECT X: EEG SIGNAL

Figure 10: Fourier Transform of the signal (EEG) representing its frequency components.

SUBJECT 1: RICKY

Figure 11: Fourier Transform of the signal (EMG Subject 1) representing its frequency components.

SUBJECT 2: RIFAT

Figure 12: Fourier Transform of the signal (EMG Subject 2) representing its frequency components.

Page | 81
BME 3204 LAB REPORT 05

SUBJECT 3: TRISHA

Figure 13: Fourier Transform of the signal (EMG Subject 3) representing its frequency components.

SUBJECT 4: SANJIDA

Figure 14: Fourier Transform of the signal (EMG Subject 4) representing its frequency components.

SUBJECT 5: NOUSHIN

Figure 15: Fourier Transform of the signal (EMG Subject 5) representing its frequency components.

Page | 82
BME 3204 LAB REPORT 05

Figure Description:

These figures present the frequency domain analysis of Electromyography (EMG) signals
from five different subjects and an Electroencephalography (EEG) signal. Each figure
illustrates the spectral characteristics of the signals using Fast Fourier Transform (FFT),
revealing the dominant frequency components present in muscle and brain activity.

The EMG figures capture muscle activity, where the frequency distribution varies based on
movement intensity, fatigue, and neural activation. High-frequency components typically
correspond to rapid muscle contractions, while lower frequencies indicate sustained activity.
The EEG figure represents brainwave activity, showcasing characteristic frequency bands such
as delta, theta, alpha, and beta waves, which are essential for cognitive and neurological
assessments. This frequency analysis aids in understanding physiological patterns, identifying
abnormalities, and optimizing biomedical signal processing techniques for clinical and
research applications.

VII. DISCUSSION

The analysis of ECG and EMG signals using Empirical Mode Decomposition (EMD),
Continuous Wavelet Transform (CWT), and Frequency Domain Methods has demonstrated the
effectiveness of these techniques in biomedical signal processing. Key findings include:

1. The EMD approach successfully decomposed ECG signals into Intrinsic Mode Functions
(IMFs), isolating both high-frequency noise and essential cardiac components. The
reconstructed signals closely resembled the original ECG waveforms, confirming the
reliability of EMD for feature extraction and denoising. Notably, the segmentation of
normal and post-exercise ECG signals highlighted physiological variations due to increased
heart rate and altered frequency distributions.
2. The application of CWT provided valuable time-frequency analysis, allowing the detection
of transient changes in ECG signals. The wavelet-based representation was particularly
useful in identifying specific cardiac events, such as PQRST waveforms, and tracking
frequency shifts due to exercise. The superior time-localization capability of CWT makes
it a powerful tool for analyzing non-stationary biomedical signals, making it advantageous
for clinical diagnostics and real-time monitoring.

Page | 83
BME 3204 LAB REPORT 05

3. Statistical and frequency domain analysis further complemented these findings by


quantifying key signal properties, including mean, standard deviation, skewness, and
kurtosis. The computation of signal energy and power provided insights into the signal's
strength and variability, while the Fourier Transform revealed dominant frequency
components crucial for characterizing muscle activity in EMG signals and brain activity in
EEG signals. The power spectral density (PSD) analysis contributed to understanding the
distribution of energy across different frequencies, which is vital for detecting
abnormalities in biomedical signals.
4. Overall, this study emphasizes the importance of combining multiple signal processing
techniques to achieve a comprehensive understanding of ECG and EMG signals. The
integration of EMD, CWT, and frequency domain methods enhances the accuracy of
feature extraction, noise reduction, and pattern recognition, thereby improving diagnostic
capabilities in biomedical engineering. Future work may focus on refining these methods,
integrating machine learning approaches for automated classification, and implementing
real-time monitoring systems for clinical applications.

VIII. CONCLUSION

By integrating EMD, CWT, and frequency domain methods, we can achieve a more
nuanced and detailed analysis of ECG and EMG signals, making it possible to detect
abnormalities and track physiological changes with greater precision. EMD and CWT, in
particular, offer significant advantages over traditional Fourier analysis, especially when
dealing with non-stationary signals. These methods can improve diagnostic accuracy, leading
to better outcomes for patients with cardiovascular and neuromuscular disorders. Future studies
could explore real-time applications of these techniques in clinical monitoring systems for even
more effective disease management.

Page | 84

You might also like