DT_filter_ex - % % %I.SignalAccessandExploration% % %

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%  %%%%%%  I. Signal Access and Exploration  %%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%  [x,Fs]=wavread('guitar1.wav');  x=x.';   % convert into row vector  sound(x,Fs);  t=(0:49999)*(1/Fs);  plot(t,x(1:50000))  title('Original Signal')  xlabel('t  (s)')  ylabel('signal x[n]')  grid  X1=fftshift(fft(x(20000+(1:16384)),65536));  X2=fftshift(fft(x(40000+(1:16384)),65536));  X3=fftshift(fft(x(60000+(1:16384)),65536));  X4=fftshift(fft(x(80000+(1:16384)),65536));  f=(-32768:32767)*Fs/65536;  figure  subplot(2,2,1)  plot(f/1e3,20*log10(abs(X1)));  title('DFTs of Original Signal')  axis([-20 20 -60 60])  xlabel('f (kHz)')  ylabel('|DFT|  (dB)')  grid  subplot(2,2,2)  plot(f/1e3,20*log10(abs(X2))); 
Background image of page 1

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

View Full DocumentRight Arrow Icon
axis([-20 20 -60 60])  xlabel('f (kHz)')  ylabel('|DFT|  (dB)')  grid  subplot(2,2,3)  plot(f/1e3,20*log10(abs(X3)));  axis([-20 20 -60 60])  xlabel('f (kHz)')  ylabel('|DFT|  (dB)')  grid  subplot(2,2,4)  plot(f/1e3,20*log10(abs(X4)));  axis([-20 20 -60 60])  xlabel('f (kHz)')  ylabel('|DFT|  (dB)')  grid  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%  %%%%%%  II. Adding A High Frequency Interference  %%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%  omega=2*pi*(10000/Fs);  % convert 10 kHz into DT frequency  N=length(x);  n=0:(N-1);  x_10=x+cos(omega*n);  sound(x_10,Fs);  figure  t=(0:49999)*(1/Fs);  plot(t,x_10(1:50000),'r',t,x(1:50000)) 
Background image of page 2
title('TD Comparison of Signal w/ and w/o Interferer')  legend('w/ interference','w/o interference')  xlabel('t  (s)')  ylabel('signal x[n]')  grid  X_10_1=fftshift(fft(x_10(20000+(1:16384)),65536));  figure;  subplot(2,1,1)  plot(f/1e3,20*log10(abs(X_10_1)));  title('DFT of Signal w/ Interference')  axis([-20 20 -60 90])  xlabel('f (kHz)')  ylabel('|DFT|  (dB)')  grid  subplot(2,1,2)  plot(f/1e3,20*log10(abs(X1)));  title('DFT of Signal w/o Interference')  axis([-20 20 -60 90])  xlabel('f (kHz)')  ylabel('|DFT|  (dB)')  grid  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%  %%%%%%  III. Lowpass Filter Design  %%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%  % Lowpass Filter Design Specifications:  Lowpass filter   Passband cutoff frequency = 7 kHz  Stopband cutoff frequency = 9 kHz 
Background image of page 3

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

View Full DocumentRight Arrow Icon
Sampling Frequency = 44.1 kHz  (frequencies of interest 0 to 22.05 kHz)  At least 60 dB of stopband attenuation  No more than 1 dB passband ripple  rp=1;    % specify passband ripple in dB  rs=60;    % specify stopband attenuation in dB  f_spec=[7000 9000];   % specify passband and stopband edges in Hz  a=[1 0];    %%%  specfies that you want a lowpass filter  dev=[(10^(rp/20)-1)/(10^(rp/20)+1) 10^(-rs/20)];   % compute a parameter needed by 
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/29/2012 for the course EECE 301 taught by Professor Fowler during the Fall '08 term at Binghamton University.

Page1 / 12

DT_filter_ex - % % %I.SignalAccessandExploration% % %

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online