HW 6 Solution 2

# HW 6 Solution 2 - plot(t(201:300),real(x20(201:300))) 0.1...

This preview shows pages 1–3. Sign up to view the full content.

Problem 3. n = -20:20; D_n = (1-exp(-2*pi*1j*n)./(2*pi*1j*n)); subplot (2,1,1); stem(n,abs(D_n), 'k' ); xlabel( 'n' );ylabel( '|D_n|' ); subplot (2,1,2); stem(n,angle(D_n), 'k' ); xlabel( 'n' );ylabel( '\angle D_n [rad]' ); -20 -15 -10 -5 0 5 10 15 20 0 0.5 1 1.5 n |D n | -20 -15 -10 -5 0 5 10 15 20 -2 0 2 4 n D [rad] % reconstruct with 5 terms w0=2*pi; dt=1/400; x5=zeros(size(t)); for n=-5:5 coef=trapz(ramp1.*exp(-1i*n*w0*t))*dt; x5 = x5 + coef.*exp(1i*w0*n*t); end plot(t(201:300),real(x5(201:300))) % reconstruct with 10 terms x10=zeros(size(t)); for n=-10:10 coef=trapz(ramp1.*exp(-1i*n*w0*t))*dt; x10 = x10 + coef.*exp(1i*w0*n*t); end plot(t(201:300),real(x10(201:300))) % reconstruct ecg signal with 20 terms x20=zeros(size(t)); for n=-20:20 coef=trapz(ramp1.*exp(-1i*n*w0*t))*dt; x20 = x20 + coef.*exp(1i*w0*n*t); end

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: plot(t(201:300),real(x20(201:300))) 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.2 0.4 0.6 0.8 1 1.2 1.4 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-0.2 0.2 0.4 0.6 0.8 1 1.2 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-0.2 0.2 0.4 0.6 0.8 1 1.2 Problem 4 % reconstruct ecg signal with 50 terms x50=zeros(size(t)); for n=-50:50 coef=trapz(ramp1.*exp(-1i*n*w0*t))*dt; %confused by these 2 lines. x50 = x50 + coef.*exp(1i*w0*n*t); end plot(t,real(x50)) -2-1.5-1-0.5 0.5 1 1.5 2 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 From the amplitude spectrum, it is a notch filter (bandstop). As the order of the filter increases, it more accurately reproduces the input signal by better representing the high-frequency signal components....
View Full Document

## This note was uploaded on 12/14/2011 for the course BME 343 taught by Professor Emelianov during the Spring '09 term at University of Texas.

### Page1 / 3

HW 6 Solution 2 - plot(t(201:300),real(x20(201:300))) 0.1...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online