SLIDE 8 idi = ceil(ed*fs/2); % Duration before and after each event did = (-idi:idi)’; % Segment indices (samples) t = did/fs; % Segment indices (seconds) I = did*ones(1,length(si)) + ones(length(did),1)*si’; % Matrix of segment indices I(I<=0) = 1; % Handle left edge condition I(I>nx) = nx; % Handle right edge condition co = median(x(I),2); figure; FigureSet(1,’LTX’); t = did/fs; h = plot(t,x(I),’b’,t,median(x(I),2),’g’); set(h,’Color’,0.8*[1 1 1]); set(h(end),’Color’,0.5*[0 1 0]); set(h,’LineWidth’,0.1); set(h(end),’LineWidth’,2); xlabel(’Time (s)’); ylabel(’Signal ($\mu$V?)’); xlim([t(1) t(end)]); box off; AxisSet; print(’MERTemplate’,’-depsc’); %================================================ % Plot a Segment of the Matched Filter Output %================================================ es = ceil(ed*fs/2); y = filter(flipud(co),1,[x;zeros(es,1)]); y = y(es+(0:nx-1)); % HERE - I don’t understand this figure; FigureSet(1,’LTX’); k = 1:length(x); t = (k-0.5)/fs; h = plot(t,y,’b’,t(si),y(si),’r.’); set(h,’LineWidth’,0.5); xlabel(’Time (s)’);
Portland State University ECE 539/639 Applications
31
Example 1: Output Segment 0.16 0.18 0.2 0.22 −2 −1 1 2 3 Time (s) Matched Filter Output
Portland State University ECE 539/639 Applications
29
ylabel(’Matched Filter Output’); xlim([0.15 0.23]); box off; AxisSet; print(’MEROutputSegment’,’-depsc’); %================================================ % Plot a Segment of the Matched Filter Output %================================================ DetectionPlot(x,fs,si,2); FigureSet(1,’LTX’); AxisSet; print(’MERDetectionHistogram’,’-depsc’);
Portland State University ECE 539/639 Applications
32
Example 1: MATLAB Code
clear all; close all; %================================================ % User-Specified Parameters %================================================ ed = 1e-3; % Event duration (seconds) %================================================ % Load the Signal %================================================ load MER; x = x(1:ceil(5*fs)); si = si(si<ceil(5*fs)); %================================================ % Plot A Segment of the Signal %================================================ figure; FigureSet(1,’LTX’);k = 1:length(x); t = (k-0.5)/fs; h = plot(t,x,’b’,t(si),x(si),’r.’); set(h,’LineWidth’,0.5); xlabel(’Time (s)’); ylabel(’Signal ($\mu$V?)’); xlim([0.15 0.23]); box off; AxisSet; print(’MERSignalSegment’,’-depsc’); %================================================ % Plot the Template %================================================ nx = length(x);
Portland State University ECE 539/639 Applications
30