Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
28 views1 page

MATLAB Grader

The document describes a MATLAB script that plots ECG signal data. The script generates two figures, the first compares the raw and smoothed ECG signals, and the second shows the effect of applying different numbers of smoothing passes to the signal.

Uploaded by

johnson2004412
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)
28 views1 page

MATLAB Grader

The document describes a MATLAB script that plots ECG signal data. The script generates two figures, the first compares the raw and smoothed ECG signals, and the second shows the effect of applying different numbers of smoothing passes to the signal.

Uploaded by

johnson2004412
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/ 1

MATLAB Grader Johnson Zhang


 CONTENTS Close Courses & Content LMS Integration Documentation & Support

ENGGEN 131, Semester 2 2023


ENGGEN 131, Semester 2 2023  Lab 3 
 Lab 1
 Task 3.6: Plotting Signals
4 solutions submitted (max: 5) | View my solutions
 Lab 2

 Lab 3 Copy and paste the completed script into the "Script" code box below.

Note: The ThreePointSmooth, SmoothSignalPass and SmoothSignal functions are already provided to MATLAB Grader, so you
 Task 3.1: Mission Impossible?
do not need to add this function to the "Script" code box.

 Task 3.2: While Loops Note: The ECG_Signal.mat file is already provided to MATLAB Grader.

Note: Page L3-11, it should say "set the 𝑥-axis to the domain [0, 0.75]". That is, it should match the figures.
 Task 3.3: For Loops

 Task 3.4: Signal Smoothing

 Task 3.5: Signal Smoothing n Times


Script   Reset  MATLAB Documentation
 Task 3.6: Plotting Signals

1 % The following declarations are required for our tests to work.


 Task 3.7: Vector Algebra
2 f1 = figure(1);
3 f2 = figure(2);
 Lab 4 4 % Copy and Paste your submission below ignoring the above code.
5 %% PlottedSignal.m plots and show the difference between unsmoothed and smoothed signals
6 %Author: Runjia Zhang
 Lab 5
7
8 %% Figure 1 showing the unprocessed and the Processed signals
 Lab 6 9 load("ECG_Signal.mat")
10 figure(1)
 MATLAB Project 2023 11
12 axis([0, 0.75, -0.25, 1])
13 X = t;
 MATLAB Project 2022
14 Y = ecg;
15 Y1 = SmoothSignal(ecg, 100);
 MATLAB Project 2021 16
17 xlabel("Time (s)")
18 ylabel("Voltage (mV)")
19
20 hold("on")
21 plot(X, Y, "g")
22 plot(X,Y1, "r:")
23
24 legend("Unprocessed Signal", "Processed Signal")
25 title("Unprocessed and Processed Signals")
26
27 %% Figure 2 showing three signal graph at three different pass
28 figure(2)
29
30 Y1 = SmoothSignal(ecg, 100);
31 Y2 = SmoothSignal(ecg, 1);
32
33 hold("on")
34
35 subplot(1,3,1)
36 plot(X, Y, "k")
37 title("Unprocessed")
38 xlabel("Time (s)")
39 ylabel("Voltage (mV)")
40
41 axis([0, 0.75, -0.25, 1])
42 subplot(1,3,2)
43 plot(X,Y2, "k")
44 title("Processed (1 pass)")
45 xlabel("Time (s)")
46 ylabel("Voltage (mV)")
47
48 axis([0, 0.75, -0.25, 1])
49 subplot(1,3,3)
50 plot(X,Y1, "k")
51 title("Processed (100 passes)")
52 xlabel("Time (s)")
53 ylabel("Voltage (mV)")
54
55
56 axis([0, 0.75, -0.25, 1])
57
58
59
60
61 %% PlottedSignal.m plots and show the difference between unsmoothed and smoothed signals
62 %Author: Runjia Zhang
63
64 %% Figure 1 showing the unprocessed and the Processed signals
65 load("ECG_Signal.mat")
66 figure(1)
67
68 axis([0, 0.75, -0.25, 1])
69 X = t;
70 Y = ecg;
71 Y1 = SmoothSignal(ecg, 100);
72
73 xlabel("Time (s)")
74 ylabel("Voltage (mV)")
75
76 hold("on")
77 plot(X, Y, "g")
78 plot(X,Y1, "r:")
79
80 legend("Unprocessed Signal", "Processed Signal")
81 title("Unprocessed and Processed Signals")
82
83 %% Figure 2 showing three signal graph at three different pass
84 figure(2)
85
86 Y1 = SmoothSignal(ecg, 100);
87 Y2 = SmoothSignal(ecg, 1);
88
89 hold("on")
90
91 axis([0, 0.75, -0.25, 1])
92 subplot(1,3,1)
93 plot(X, Y, "k")
94 title("Unprocessed")
95 xlabel("Time (s)")
96 ylabel("Voltage (mV)")
97
98 axis([0, 0.75, -0.25, 1])
99 subplot(1,3,2)
100 plot(X,Y2, "k")
101 title("Processed (1 pass)")
102 xlabel("Time (s)")
103 ylabel("Voltage (mV)")
104
105 axis([0, 0.75, -0.25, 1])
106 subplot(1,3,3)
107 plot(X,Y1, "k")
108 title("Processed (100 passes)")
109 xlabel("Time (s)")
110 ylabel("Voltage (mV)")
111
112
113 axis([0, 0.75, -0.25, 1])
114
115
116
117
118

 Run Script 

Assessment: Run Pretest  Submit (Attempt 5 of 5) 

Pretest results are not submitted for grading. To run all the tests and submit the results for grading, click Submit.

 Remove any clear and clearvars functions. (Pretest)

 General Figure Layouts (Pretest)


Figure 1: Have you plotted two solutions?

Do your figures look like the expected figures?

Figure 1 Data

Figure 1 Style

Figure 2 Data

Figure 2 Style

Output


Figure 2 of 2

Trust Center Trademarks Privacy Policy Preventing Piracy Application Status


© 1994-2023 The MathWorks, Inc.

You might also like