Nt1310 Unit 10 Lab Report

302 Words2 Pages
%% Init % clear all; close all; Fs = 4e3; Time = 40; NumSamp = Time * Fs; load Hd; x1 = 3.5*ecg(2700). '; % gen synth ECG signal y1 = sgolayfilt(kron(ones(1,ceil(NumSamp/2700)+1),x1),0,21); % repeat for NumSamp length and smooth n = 1:Time*Fs '; del = round(2700*rand(1)); % pick a random offset mhb = y1(n + del) '; %construct the ecg signal from some offset t = 1/Fs:1/Fs:Time '; subplot(3,3,1); plot(t,mhb); axis([0 2 -4 4]); grid; xlabel( 'Time [sec] '); ylabel( 'Voltage [mV] '); title( 'Maternal Heartbeat Signal '); x2 = 0.25*ecg(1725); y2 = sgolayfilt(kron(ones(1,ceil(NumSamp/1725)+1),x2),0,17); del = round(1725*rand(1)); fhb = y2(n + del) '; subplot(3,3,2); plot(t,fhb, 'm '); axis([0 2 -0.5 0.5]); grid; xlabel( 'Time [sec] '); ylabel(…show more content…
Voltage [mV] '); title( 'Fetal Heartbeat Signal '); Wopt = [0 1.0 -0.5 -0.8 1.0 -0.1 0.2 -0.3 0.6 0.1]; %Wopt = rand(1,10); d = filter(Wopt,1,mhb) + fhb + 0.02*randn(size(mhb)); subplot(3,3,3); plot(t,d, 'r '); axis([0 2 -4 4]); %axis tight; grid; xlabel( 'Time [sec] ');…show more content…
onvergence of Adaptive Noise Canceller '); legend( 'Measured Signal ', 'Error Signal '); subplot(3,3,6); plot(t,e, 'r '); hold on; plot(t,fhb, 'b '); axis([Time-4 Time -0.5 0.5]); grid on; xlabel( 'Time [sec] '); ylabel( 'Voltage [mV] '); title( 'Steady-State Error Signal '); legend( 'Calc Fetus ', 'Ref Fetus ECG '); filt_e = filter(Hd,e); subplot(3,3,7); plot(t,fhb, 'r '); hold on; plot(t,filt_e, 'b '); axis([Time-4 Time -0.5 0.5]); grid on; xlabel( 'Time [sec] '); ylabel( 'Voltage [mV] '); title( 'Filtered signal '); legend( 'Ref Fetus ', 'Filtered Fetus '); thresh = 4*mean(abs(filt_e))*ones(size(filt_e)); peak_e = (filt_e >= thresh); edge_e = (diff([0; peak_e]) >0); subplot(3,3,8); plot(t,filt_e, 'c '); hold on; plot(t,thresh, 'r '); plot(t,peak_e, 'b '); xlabel( 'Time [sec] '); ylabel( 'Voltage [mV] '); title( 'Peak detection '); legend( 'Filtered fetus ', 'Dyna thresh ', 'Peak marker ', 'Location ', 'SouthEast '); axis([Time-4 Time -0.5 0.5]); subplot(3,3,9); plot(t,filt_e, 'r '); hold on; plot(t,edge_e, 'b '); plot(0,0, 'w '); fetus_calc = round((60/length(edge_e(16001:end))*Fs)* sum(edge_e(16001:end))); fetus_bpm = [ 'Fetus Heart Rate = ' mat2str(fetus_calc)]; xlabel( 'Time [sec] '); ylabel( 'Voltage [mV] '); title( 'Reconstructed fetus

More about Nt1310 Unit 10 Lab Report

Open Document