% This file was automatically created from the m-file 
% "m2tex.m" written by USL. 
% The fontencoding in this file is UTF-8. 
%  
% You will need to include the following two packages in 
% your LaTeX-Main-File. 
%  
% \usepackage{color} 
% \usepackage{fancyvrb} 
%  
% It is advised to use the following option for Inputenc 
% \usepackage[utf8]{inputenc} 
%  
  
% definition of matlab colors: 
\definecolor{mblue}{rgb}{0,0,1} 
\definecolor{mgreen}{rgb}{0.13333,0.5451,0.13333} 
\definecolor{mred}{rgb}{0.62745,0.12549,0.94118} 
\definecolor{mgrey}{rgb}{0.5,0.5,0.5} 
\definecolor{mdarkgrey}{rgb}{0.25,0.25,0.25} 
  
\DefineShortVerb[fontfamily=courier,fontseries=m]{\$} 
\DefineShortVerb[fontfamily=courier,fontseries=b]{\#} 
  
\noindent                                                                                                                                                            
 \hspace*{-1.6em}{\scriptsize 1}$  $\color{mgrey}#%% Template for notch filtering of ECG signals#\color{black}$$\\
 \hspace*{-1.6em}{\scriptsize 2}$  clear, $\color{mdarkgrey}$clc, close all$\color{black}$$\\
 \hspace*{-1.6em}{\scriptsize 3}$  $\\
 \hspace*{-1.6em}{\scriptsize 4}$  $\color{mgrey}#%% Loads ECG signal from file#\color{black}$$\\
 \hspace*{-1.6em}{\scriptsize 5}$  $\color{mgrey}$% This loads the following variables:$\color{black}$$\\
 \hspace*{-1.6em}{\scriptsize 6}$  $\color{mgrey}$% - ecg_clean: ecg_signal without 60 Hz interference. Use this only for$\color{black}$$\\
 \hspace*{-1.6em}{\scriptsize 7}$  $\color{mgrey}$% comparison$\color{black}$$\\
 \hspace*{-1.6em}{\scriptsize 8}$  $\color{mgrey}$% - ecg_60Hz: ECG signal corrupted by 60 Hz interference$\color{black}$$\\
 \hspace*{-1.6em}{\scriptsize 9}$  $\color{mgrey}$% - N: length of the vectors ecg_clean and ecg_60Hz$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 10}$  $\color{mgrey}$% - T (in seconds): sampling period of ECG recordings. T = 3 ms.$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 11}$  load($\color{mdarkgrey}$'ecg_recording.mat'$\color{black}$) $\\
 \hspace*{-2em}{\scriptsize 12}$  $\color{mgrey}$% Note: these signals are real ECG recordings made with standard ECG recorders, $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 13}$  $\color{mgrey}$% leads, and electrodes. The quality is typical of ambulatory ECG recordings.$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 14}$  $\color{mgrey}$% The 60 Hz component was introduced artificially for this exercise.$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 15}$  $\color{mgrey}$% The complete database can be found online on PhysioNet [1]: $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 16}$  $\color{mgrey}$% http://www.physionet.org/physiobank/database/nstdb/$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 17}$  $\color{mgrey}$% This database is discrebed in [2].$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 18}$  $\color{mgrey}$% References:$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 19}$  $\color{mgrey}$% [1] Goldberger AL, Amaral LAN, Glass L, Hausdorff JM, Ivanov PCh, Mark RG, $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 20}$  $\color{mgrey}$% Mietus JE, Moody GB, Peng C-K, Stanley HE. PhysioBank, PhysioToolkit, and $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 21}$  $\color{mgrey}$% PhysioNet: Components of a New Research Resource for Complex Physiologic $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 22}$  $\color{mgrey}$% Signals. Circulation 101(23):e215-e220 [Circulation Electronic Pages; $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 23}$  $\color{mgrey}$% http://circ.ahajournals.org/content/101/23/e215.full]; 2000 (June 13).$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 24}$  $\color{mgrey}$% [2] Moody GB, Muldrow WE, Mark RG. A noise stress test for arrhythmia detectors. $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 25}$  $\color{mgrey}$% Computers in Cardiology 1984; 11:381-384.$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 26}$  $\\
 \hspace*{-2em}{\scriptsize 27}$  t = 0:T:(N-1)*T; $\color{mgrey}$% time vector$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 28}$  $\\
 \hspace*{-2em}{\scriptsize 29}$  $\color{mgrey}$% Plot signals$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 30}$  figure, $\color{mdarkgrey}$box on, hold on$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 31}$  plot(t, ecg_clean, $\color{mdarkgrey}$'k'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 32}$  plot(t, $\color{mdarkgrey}$ecg_60Hz)$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 33}$  xlabel($\color{mdarkgrey}$'Time (s)'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 34}$  ylabel($\color{mdarkgrey}$'ECG'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 35}$  legend($\color{mdarkgrey}$'Clean ECG'$\color{black}$, $\color{mdarkgrey}$'ECG corrupted by 60 Hz'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 36}$  $\\
 \hspace*{-2em}{\scriptsize 37}$  $\color{mgrey}#%% Your code goes here#\color{black}$$\\
 \hspace*{-2em}{\scriptsize 38}$  $\color{mgrey}$% a)$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 39}$  lamb = 2*pi*60;$\\
 \hspace*{-2em}{\scriptsize 40}$  b = 2*pi*5; $\color{mgrey}$% there's more than one right answer for this.$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 41}$  $\\
 \hspace*{-2em}{\scriptsize 42}$  $\color{mgrey}$% Analog notch filter coefficients$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 43}$  bs = [1 0 lamb^2];$\\
 \hspace*{-2em}{\scriptsize 44}$  as = [1 b lamb^2];$\\
 \hspace*{-2em}{\scriptsize 45}$  $\\
 \hspace*{-2em}{\scriptsize 46}$  $\color{mgrey}$% b)$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 47}$  $\color{mgrey}$% Bilinear transformation with and without frequency pre-warping$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 48}$  [bzw, $\color{mdarkgrey}$azw] = bilinear(bs, as, 1/T); $\color{black}$$\color{mgrey}$% without$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 49}$  [bz, $\color{mdarkgrey}$az] = bilinear(bs, as, 1/T, lamb/(2*pi)); $\color{black}$$\color{mgrey}$% with$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 50}$  $\\
 \hspace*{-2em}{\scriptsize 51}$  $\color{mgrey}$% c)$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 52}$  [Hw, $\color{mdarkgrey}$w] = freqz(bzw, azw);$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 53}$  H = freqz(bz, az, w);$\\
 \hspace*{-2em}{\scriptsize 54}$  $\\
 \hspace*{-2em}{\scriptsize 55}$  figure, $\color{mdarkgrey}$hold on, box on$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 56}$  plot(w/(2*pi*T), 20*log10(abs(Hw)), $\color{mdarkgrey}$'Linewidth'$\color{black}$, 2$\color{mdarkgrey}$$\color{mdarkgrey}$', '$\color{black}$$\color{black}$DisplayName$\color{mdarkgrey}$$\color{mdarkgrey}$', '$\color{black}$$\color{black}$W/o frequency pre-warping')$\\
 \hspace*{-2em}{\scriptsize 57}$  plot(w/(2*pi*T), 20*log10(abs(H)), $\color{mdarkgrey}$'Linewidth'$\color{black}$, 2$\color{mdarkgrey}$$\color{mdarkgrey}$', '$\color{black}$$\color{black}$DisplayName$\color{mdarkgrey}$$\color{mdarkgrey}$', '$\color{black}$$\color{black}$W/ frequency pre-warping')$\\
 \hspace*{-2em}{\scriptsize 58}$  xlabel($\color{mdarkgrey}$'Frequency (Hz)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 59}$  ylabel($\color{mdarkgrey}$'Magnitude (dB)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 60}$  set(gca, $\color{mdarkgrey}$'xtick'$\color{black}$, [60])$\\
 \hspace*{-2em}{\scriptsize 61}$  grid $\color{mdarkgrey}$on$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 62}$  set(gca, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 63}$  legend($\color{mdarkgrey}$'-dynamiclegend'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 64}$  saveas(gca, $\color{mdarkgrey}$'../figs/bilinear_ecg'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 65}$  $\\
 \hspace*{-2em}{\scriptsize 66}$  $\color{mgrey}$% d) $\color{black}$$\\
 \hspace*{-2em}{\scriptsize 67}$  figure, $\color{mdarkgrey}$zplane(bz, az)$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 68}$  saveas(gca, $\color{mdarkgrey}$'../figs/zplane_bilinear_ecg'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 69}$  $\\
 \hspace*{-2em}{\scriptsize 70}$  $\color{mgrey}$% e)$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 71}$  ecg_filtered = filter(bz, az, ecg_60Hz);$\\
 \hspace*{-2em}{\scriptsize 72}$  $\\
 \hspace*{-2em}{\scriptsize 73}$  figure, $\color{mdarkgrey}$hold on, box on$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 74}$  plot(t, ecg_60Hz, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'ECG + 60 Hz'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 75}$  plot(t, ecg_filtered, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'Filtered ECG'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 76}$  legend($\color{mdarkgrey}$'-dynamiclegend'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 77}$  xlabel($\color{mdarkgrey}$'Time (s)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 78}$  ylabel($\color{mdarkgrey}$'ECG'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 79}$  set(gca, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 80}$  saveas(gca, $\color{mdarkgrey}$'../figs/ecg_comparison1'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 81}$  $\\
 \hspace*{-2em}{\scriptsize 82}$  figure, $\color{mdarkgrey}$hold on, box on$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 83}$  plot(t, ecg_clean, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'Clean ECG'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 84}$  plot(t, ecg_filtered, $\color{mdarkgrey}$'--'$\color{black}$, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'Filtered ECG'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 85}$  legend($\color{mdarkgrey}$'-dynamiclegend'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 86}$  xlabel($\color{mdarkgrey}$'Time (s)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 87}$  ylabel($\color{mdarkgrey}$'ECG'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 88}$  set(gca, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2em}{\scriptsize 89}$  saveas(gca, $\color{mdarkgrey}$'../figs/ecg_comparison2'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\
 \hspace*{-2em}{\scriptsize 90}$  $\\
 \hspace*{-2em}{\scriptsize 91}$  $\color{mgrey}$% f)$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 92}$  $\color{mgrey}$% Define filter parameters$\color{black}$$\\
 \hspace*{-2em}{\scriptsize 93}$  L = 53;$\\
 \hspace*{-2em}{\scriptsize 94}$  M = L-1;$\\
 \hspace*{-2em}{\scriptsize 95}$  Deltaw1 = 0.018*pi;$\\
 \hspace*{-2em}{\scriptsize 96}$  Deltaw2 = 0.04*pi;$\\
 \hspace*{-2em}{\scriptsize 97}$  N = 1000;$\\
 \hspace*{-2em}{\scriptsize 98}$  $\\
 \hspace*{-2em}{\scriptsize 99}$  $\color{mgrey}$% Frequnecy vector$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 100}$  wc = 2*pi*60*T;$\\
 \hspace*{-2.4em}{\scriptsize 101}$  w = linspace(0, pi, N);$\\
 \hspace*{-2.4em}{\scriptsize 102}$  $\\
 \hspace*{-2.4em}{\scriptsize 103}$  $\color{mgrey}$% Desired response$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 104}$  d = ones(size(w));$\\
 \hspace*{-2.4em}{\scriptsize 105}$  d(w $\color{mdarkgrey}$>= wc-Deltaw1/2 & w <= wc+Deltaw1/2) = 0;$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 106}$  $\\
 \hspace*{-2.4em}{\scriptsize 107}$  $\color{mgrey}$% Weight function$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 108}$  wv = ones(size(w));$\\
 \hspace*{-2.4em}{\scriptsize 109}$  wv(w $\color{mdarkgrey}$>= wc-Deltaw1/2-Deltaw2 & w < wc-Deltaw1/2) = 0;$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 110}$  wv(w $\color{mdarkgrey}$>= wc+Deltaw1/2 & w < wc+Deltaw1/2+Deltaw2) = 0;$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 111}$  $\\
 \hspace*{-2.4em}{\scriptsize 112}$  $\color{mgrey}$% Plot desired response and window function$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 113}$  figure, $\color{mdarkgrey}$hold on$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 114}$  plot(w, $\color{mdarkgrey}$d)$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 115}$  plot(w, wv, $\color{mdarkgrey}$'r'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 116}$  title($\color{mdarkgrey}$'desired response and window function'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 117}$  $\\
 \hspace*{-2.4em}{\scriptsize 118}$  $\color{mgrey}$% Design the filter$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 119}$  hls = firls(M, w(wv ~= 0)/pi, d(wv ~= 0));$\\
 \hspace*{-2.4em}{\scriptsize 120}$  $\\
 \hspace*{-2.4em}{\scriptsize 121}$  $\color{mgrey}$% Plot results$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 122}$  Hls = freqz(hls, 1, w);$\\
 \hspace*{-2.4em}{\scriptsize 123}$  $\\
 \hspace*{-2.4em}{\scriptsize 124}$  ecg_fir =filter(hls, 1, ecg_60Hz);$\\
 \hspace*{-2.4em}{\scriptsize 125}$  $\\
 \hspace*{-2.4em}{\scriptsize 126}$  figure, $\color{mdarkgrey}$box on$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 127}$  plot(w/(2*pi*T), 20*log10(abs(Hls)), $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2)$\\
 \hspace*{-2.4em}{\scriptsize 128}$  xlabel($\color{mdarkgrey}$'Frequency (Hz)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 129}$  ylabel($\color{mdarkgrey}$'Magnitude (dB)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 130}$  set(gca, $\color{mdarkgrey}$'xtick'$\color{black}$, [60])$\\
 \hspace*{-2.4em}{\scriptsize 131}$  saveas(gca, $\color{mdarkgrey}$'../figs/ecg_fir_notch'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 132}$  $\\
 \hspace*{-2.4em}{\scriptsize 133}$  figure, $\color{mdarkgrey}$box on$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 134}$  plot(w/(2*pi*T), unwrap(angle(Hls)), $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2)$\\
 \hspace*{-2.4em}{\scriptsize 135}$  xlabel($\color{mdarkgrey}$'Frequency (Hz)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 136}$  ylabel($\color{mdarkgrey}$'Phase (rad)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 137}$  set(gca, $\color{mdarkgrey}$'xtick'$\color{black}$, [60])$\\
 \hspace*{-2.4em}{\scriptsize 138}$  saveas(gca, $\color{mdarkgrey}$'../figs/ecg_fir_notch_phase'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 139}$  $\\
 \hspace*{-2.4em}{\scriptsize 140}$  figure, $\color{mdarkgrey}$hold on, box on$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 141}$  plot(t, ecg_clean, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'Clean ECG'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 142}$  plot(t, ecg_fir, $\color{mdarkgrey}$'--'$\color{black}$, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'Filtered ECG'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 143}$  legend($\color{mdarkgrey}$'-dynamiclegend'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 144}$  xlabel($\color{mdarkgrey}$'Time (s)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 145}$  ylabel($\color{mdarkgrey}$'ECG'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 146}$  set(gca, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 147}$  saveas(gca, $\color{mdarkgrey}$'../figs/ecg_fir_comparison1'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 148}$  $\\
 \hspace*{-2.4em}{\scriptsize 149}$  figure, $\color{mdarkgrey}$hold on, box on$\color{black}$$\\
 \hspace*{-2.4em}{\scriptsize 150}$  plot(t, ecg_clean, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'Clean ECG'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 151}$  plot(t, circshift(ecg_fir, [0, -M/2]), $\color{mdarkgrey}$'--'$\color{black}$, $\color{mdarkgrey}$'LineWidth'$\color{black}$, 2, $\color{mdarkgrey}$'DisplayName'$\color{black}$, $\color{mdarkgrey}$'Filtered ECG'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 152}$  legend($\color{mdarkgrey}$'-dynamiclegend'$\color{black}$)$\\
 \hspace*{-2.4em}{\scriptsize 153}$  xlabel($\color{mdarkgrey}$'Time (s)'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 154}$  ylabel($\color{mdarkgrey}$'ECG'$\color{black}$, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 155}$  set(gca, $\color{mdarkgrey}$'FontSize'$\color{black}$, 12)$\\
 \hspace*{-2.4em}{\scriptsize 156}$  saveas(gca, $\color{mdarkgrey}$'../figs/ecg_fir_comparison2'$\color{black}$, $\color{mdarkgrey}$'epsc'$\color{black}$)$\\ 
  
\UndefineShortVerb{\$} 
\UndefineShortVerb{\#}