HW9_filtering_demo - % % experiment with conventional...

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

View Full Document Right Arrow Icon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% experiment with conventional square wave %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % clf % clear figure window c % create one hundred periods of square wave sampled at frequency % fs samples per period % fs = 120; % sample at 3 times the 40th harmonic (which is 0) to reduce aliasing effects % 3 times the 40th is 120 times the fundamental % 120 times the fundamental is 120 samples per period one_period = [ones(1,fs/2) -ones(1,fs/2)]; % note there are fs=120 samples per period sqrwave1 = []; % empty vector for i = 1:100, sqrwave1 = [sqrwave1 one_period]; end plot(linspace(0,4,4*fs),sqrwave1(1:4*fs)) % plot only 4 periods axis([0 4 -1.1 1.1]) grid pause p % create impulse response of FIR filter with cutoff freqency % equal to 2*fo (fo = fundamental freq of square wave) % L = 200; % set ~half of filter length n = (-L:L)+1e-10; % need offset at n=0 for sinc computation below h = sin(2*pi*n/fs) ./ (2*pi*n/fs); % sinc filter "taps", arbitrarily choose
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/10/2009 for the course ECE 340 taught by Professor Djordjevic during the Fall '08 term at University of Arizona- Tucson.

Page1 / 2

HW9_filtering_demo - % % experiment with conventional...

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

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