ADVANCED DIGITAL SIGNAL PROCESSING - ADVDSP MACHINE PROBLEM 1 – FILTER DESIGN
General Instruction: 1. Make a separate .m file for each number and name each file using the convention ‘your Surname_number*.m’. Surname_number*.m’. Put all your files in a single folder, yoursurname, yoursurname , and zip the folder. Upload your files to the canvas assignment folder. 2. To get the full points, answer answer each question completely. Document your work very well such that at every step, it is clear how you came up with the decision and your work should be repeatable. For example, if you decide on a filter length of 12, explain why. 3. Embed your answers to the questions in each problem by putting a ‘commented’ delineator, such as: %%%%%%%%%% %% % ANSWERS TO QUESTIONS %% %%%%%%%%%% 4. You may use the command pause between steps. 6. You can use digital filter design functions in applicable cases. The following M-file is used to analyze the frequency component of a voice signal/wav file. [x,Fs]=wavread('FILENAME.wav'); fn=Fs/2; %calculates the Nyquist sampling rate L=length(x); %calculates the length of the signal X=fft(x,L); magX=abs(X); magX=magX(1:L/2); f = fn*[0:(L/2-1)]/(L/2); %transforms the frequency axis to Hz plot(f,magX); grid on;
PART I. Frequency Analysis using FFT Generate the signal x(n) for x(n) for N = = 50.
)+2.1sin(54 + ) = 5c 5 cos (7 + 0,1,2,2,3,3,, … , −1 −1 16 3 100 18 = 0,1 1. To get the 50-point DFT, use the fft() function. To compute and properly sketch the DFT of the signal, type the following commands X = t x % e au t output engt s equa figure(1); subplot(211); plot([0:49]*2*pi/50, abs(X)); xlabel(‘angular frequency, rad/sample’); ylabel(‘magnitude’); title(‘DFT’); subplot(212); plot([0:49]*2*pi/50, angle(X)); xlabel(‘angular frequency, rad/sample’); ylabel(‘phase’);
to t e
npu t
en gt
2. Describe the result. Is the result consistent with what you expected? The graph shows same magnitude and same peak value. So the result is consistent.
3. Generate the same signal but this time (a) increase the length of the signal by zeropadding, (b) take more samples of the signal (N=100 and N=200) and (c) combine methods (a) and (b). Which gives you an accurate answer? Why do you think so? N equals to 200 gives me much more accurate signal compare to N=100, it’s much more detailed, Zero padding the data before computing the DFT often helps to improve the accuracy.
PART 2. IIR Filter Design – Butterworth filter Write a MATLAB script to separate a mixed signal of 3 pure-tone components, as follows: a. Load a. Load the audio file mixSinusoid.wav which is composed of three pure-tone signals with some noise. b. Plot the magnitude spectrum with respect to frequency. What are the frequencies of these three components? –The frequencies of these three components are 5kHz c. Use three Butterworth filters (low-pass, bandpass, high-pass to recover these three components. What is the cutoff frequency you used for designing each filter? Plot these three components for the first 1000 points.
PART 3. FIR Filter Design In note_noise.wav, a synthesis musical note is corrupted by a quasi-periodic noise. a. What is the fundamental frequency of the synthesized note? b. Design the lowest-order FIR that can remove the noise. Filter and save the new sound as yourName_noteFIR.wav. *Note: In Matlab, use the commands wavread() and wavwrite() to read and write wav files. The commands sound() and soundsc() will playback the sound to the speakers.