Lab 08_Signal Processing
docx
keyboard_arrow_up
School
Pennsylvania State University *
*We aren’t endorsed by this school
Course
1110
Subject
Electrical Engineering
Date
Apr 3, 2024
Type
docx
Pages
5
Uploaded by SargentGoldfinchMaster1038
BIOMEDE 3702
LAB PROCEDURE: Signal Processing
Learning Objectives:
Students will be able to…
Learn how to implement different types of simple filters.
Build their own functions while keeping awareness of function/variable scoping.
Analyze and relate EMG signal characteristics with motor unit activation.
Materials:
Matlab Software
Laptop
A. Analyzing Data
In lab you will work through guided example analysis to become familiar with common signal processing techniques. First, we will construct and integrated EMG signal. Second, we will experiment with Fourier Transform to look at the frequency content of the EMG signal. Work these tasks in a script, rather than the command window. It is highly
recommended that each of the coming sections you build as independent functions. You can create functions by writing a script file as seen in Figure 1. A function allows to run complex lines of code by simply integrating them into a single named structure (called a function
). These processes can then be simply repeated by invoking the function rather than the entire lines of code.
Considerations: 1.
To call functions, these files must be saved on the same folder as any other codes being run. 2.
The name of the function of the script should match the file name (to avoid errors). 3.
Functions need an output, and can have more than one. Use the brackets [] to include more than one output. 4.
To get multiple outputs from a function, you must include the brackets (example the max function can be called as [M,I] = max(X). M will give you the value, I will give you the index. Figure 1: Function Definition Code Structure
1.
Function 1: Implementing simple filters:
BIOMEDE 3702
a.
Download the EMG Back Up Data (
Carmen > Lab Documents and Links > Backup data > Lab 1 EMG
)
b.
Select a signal from recording 2 or 4 (fatigue exercise trial). c.
The first simple filter you will apply is a highpass [y = highpass(x,fpass,fs)]. This MatLab filter will remove any baseline drifts from your signal. The function has three parameters: x
–
indexed fatigue signal, fpass – cutoff frequency of the filter in Hz (
pick 5 Hz
), and fs
– sampling frequency of the signal. Note: Consider the frequency ranges of an EMG signal!
i.
You can experiment with the highpass by calling the function without an output in the
command window. d.
Rectify the output of the highpass filter [abs()]. e.
Apply a moving average filter to the rectified highpass signal using movmean(). This MatLab
function has two parameters: A – input signal, and [kb, kf] – which are the edges of the averaging bin. Make both kb
and kf
half the sampling frequency, which would result in a 1-
second bin. f.
Plot the moving average filtered signal overtop of the rectified high pass filtered signal (but in a different color). Make sure to save this figure to include in the post lab.
2.
Function 2: Transforming into the frequency domain:
a.
Revert back to using the unfiltered fatigue exercise signal from step 1a.
b.
Compute the Fourier transform using Y = fft(X), where X is the raw signal. c.
Write Y(100) in your function and run it. You will notice that is complex (a + jb) which encode both for magnitude and phase of your complex exponential. d.
To remove the complex value, take the absolute value of Y. e.
You will also note that this output is symmetrical. Plot the absolute value of Y. You will be removing half of this spectrum. f.
To split the signal index by half your absolute value signal [signal(1:end/2+1)], then multiply
this resulting vector by 2 to conserve total power.
g.
This resulting signal is your power (P|X|) values (or y in the frequency domain), but we have yet to calculate the frequency axis.
BIOMEDE 3702
h.
You can calculate the frequency axis by creating a vector from 0 to the half-length of your raw signal [0:L/2]. Multiply these values by fs
(sampling frequency), and then divide by the total length of the raw signal. i.
Plot the resulting spectrum using the frequency axis as x, and power as y. Save this figure for the post lab.
3.
Function 3: Removing 60 Hz power line noise:
a.
If your spectrum (in section 2) shows a strong peak around 60 Hz, this is due power line or electromagnetic field noise caused by the AC power supply.
b.
Apply a bandstop filter to the raw fatigue exercise signal from step 1a. The function is similar to the high pass (
y = bandstop(x,fpass,fs)
) where fpass will be the vector of frequencies to attenuate [59,61]. c.
Plot the frequency spectrum of the bandstop signal (run the output of this function through Function 2). Notice any changes from your unprocessed signal in the previous section? Save this figure for the postlab.
4.
Function 4: Calculating the median frequency:
a.
The median frequency is a great indicator to slow/fast twitch muscle activation. As to what it calculates, you will need to look that up online (
as part of your post lab
). b.
Use freq = medfreq(x,fs) where x is the bandstop (or notched) filtered signal (in the time domain) to obtain the median frequency. Plot this value as vertical line overtop of the frequency power spectrum plot of the bandstop signal. Save these figures for the postlab
. THE POINT
In this lab, we were able to use MATLAB to create multiple functions to perform various EMG signal processing operations. We learned how to implement simple filters (highpass and bandstop) for the analysis of provided data. We saw how signals change when transformed into the frequency domain. We also learned about identifying and filtering electromagnetic field noise, as well as the importance of the median frequency in EMG signals.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
BIOMEDE 3702
POST LAB: Signal Processing
Signal Processing Lab (
20 points)
1)
Submit the following results from the data analysis. Be sure to label all figures (5 pts -1 pt each)
BIOMEDE 3702
a.
Your commented Matlab code
b.
The plot showing the integrated EMG overlaid on the rectified high pass signal.
c.
Frequency spectrum of the signal without a bandstop filter
d.
Frequency spectrum of the signal (with the bandstop filter) and median frequency overlaid
e.
What is the definition of median frequency? 2)
Perform an analysis for the pre- and post-fatiguing recording trials. Refer to the figure above for guidance on what functions to use and what plots to include in the post lab. Use Exp1_Dom_Black
as the pre and Exp1_Dom_Orange
as the post. Be sure to label all figures (10pts, 5 pts for the pre and post each)
For each the pre- and post-fatigue:
a.
Submit a figure of a smoothed EMG signal overlaid of the raw EMG signal. This analysis/figure should contain 5 replicates at the same time (~20-30 seconds of data). In other
words, you should only do the procedure once for the pre- and once for the post-fatigue exercise. b.
Submit a single subplot figure for each the pre- and post- fatigue exercise data with the subfigures containing the frequency spectrum with the median frequency overlaid for each 2 second trial (5 subfigures for each category). Remember to apply any preprocessing steps such as the notch filter to clean your data. Check Matlab documentation or the pre-lab code if
you need assistance with the subplot function. c.
Submit code for your analysis
3)
Generate a table to organize and display your trials (5 replicates for pre-fatigue and 5 replicates for post-fatigue), testing conditions, and the resulting median frequencies. (2 pts)
4)
Perform a t-test on the median frequencies to see if there is a difference between the pre and post fatiguing trials. First consider, what kind of t-test is required here?
Do you expect a difference between the two? Explain why or why not. Do the results of your test support your hypothesis? If not, explain what may have caused the discrepancy. (3 pts)
Related Documents
Related Questions
Subject name: Signal processing measurement
Question: Is there any difference between the metallic resistance and the semiconducting resistance?
arrow_forward
2. Sampling frequency is one of the important elements in signal processing. Describe the meaning of a
sampling frequency using a sketch if possible. Why is it important to set the sampling rate higher than the
maximum frequency measured?
arrow_forward
Ex. 1915. An Arduino analog input voltage is 3.160 volts. Arduino PWM output
pin drives a low-pass filter, as shown in Figure 1915. The low-pass filter
converts the PWM signal back to an average-DC voltage.
Arduino specifications include: I/0 voltage range of e to 5VDC; 10-bit A/D
input; and an 8-bit D/A PWM output.
an analog output DC volage at the low-pass filter.
Determine (Vout - Vin).
The analog input DC voltage results in
arrow_forward
Can you help me with this question? Thank you?
arrow_forward
4. Signal conditioning element basically takes the output of the sensing element and converts it into a form
more suitable for further processing, usually in the form of a DC voltage, DC current or variable frequency
AC voltage. The output of the sensing element is usually too small to operate an indicator or a recorder.
Therefore, it is suitably processed and modified in the signal conditioning element so as to obtain the output
in the desired form that is amplify the signal and filtering the unwanted signal.
i. Describe the aliasing phenomenon.
ii. Suggest a solution to minimize the effect of aliasing.
arrow_forward
Q. No 1. For the given analog signal, follow the proper steps to convert this signal to digital signal. (Take
voltage levels L = 8, n= 3). Also assign proper coding to each voltage level and draw the resultant digital
waveform for the given analog signal.
Sample times
Arnalog
imput
Time
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you

EBK ELECTRICAL WIRING RESIDENTIAL
Electrical Engineering
ISBN:9781337516549
Author:Simmons
Publisher:CENGAGE LEARNING - CONSIGNMENT
Related Questions
- Subject name: Signal processing measurement Question: Is there any difference between the metallic resistance and the semiconducting resistance?arrow_forward2. Sampling frequency is one of the important elements in signal processing. Describe the meaning of a sampling frequency using a sketch if possible. Why is it important to set the sampling rate higher than the maximum frequency measured?arrow_forwardEx. 1915. An Arduino analog input voltage is 3.160 volts. Arduino PWM output pin drives a low-pass filter, as shown in Figure 1915. The low-pass filter converts the PWM signal back to an average-DC voltage. Arduino specifications include: I/0 voltage range of e to 5VDC; 10-bit A/D input; and an 8-bit D/A PWM output. an analog output DC volage at the low-pass filter. Determine (Vout - Vin). The analog input DC voltage results inarrow_forward
- Can you help me with this question? Thank you?arrow_forward4. Signal conditioning element basically takes the output of the sensing element and converts it into a form more suitable for further processing, usually in the form of a DC voltage, DC current or variable frequency AC voltage. The output of the sensing element is usually too small to operate an indicator or a recorder. Therefore, it is suitably processed and modified in the signal conditioning element so as to obtain the output in the desired form that is amplify the signal and filtering the unwanted signal. i. Describe the aliasing phenomenon. ii. Suggest a solution to minimize the effect of aliasing.arrow_forwardQ. No 1. For the given analog signal, follow the proper steps to convert this signal to digital signal. (Take voltage levels L = 8, n= 3). Also assign proper coding to each voltage level and draw the resultant digital waveform for the given analog signal. Sample times Arnalog imput Timearrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- EBK ELECTRICAL WIRING RESIDENTIALElectrical EngineeringISBN:9781337516549Author:SimmonsPublisher:CENGAGE LEARNING - CONSIGNMENT

EBK ELECTRICAL WIRING RESIDENTIAL
Electrical Engineering
ISBN:9781337516549
Author:Simmons
Publisher:CENGAGE LEARNING - CONSIGNMENT