Department of Electrical and Electronic EngineeringELEC6026/ELEC8004 Digital Signal ProcessingAssignment: Design of Linear Phase FIR Filters(15 marks)1. Objectives:The purpose of this assignment is to study the properties of Short Time Fourier Transform(STFT) based spectral analysis and the design of one dimensional finite-duration impulseresponse (FIR) linear phase filters using MATLAB. The window method, parks-McClellanmethod and convex programming method will be studied.2. Equipment RequiredMATLAB: MATLAB is an interactive environment for high level simulation of generalnumerical applications such as numerical linear algebra, signal processing, etc. Refer tohttp://www.mathworks.com/help/matlab/ for more details.If you do not have the MATLAB software, you may use the PC workstations located at theCYC103 Laboratory.Reference: A.V. Oppenheim, Discrete-time Signal Processing, Prentice-Hall, 1991.3. Submission Format and DeadlineA brief written report addressing the problems listed in section 5 should be submitted either inMicrosoft Word or PDF format together with the appended MATLAB codes and uploaded tothe Moodle System by Nov 20, 2019 23:55 (GMT +8:00).4. Theory4.1 Window methodWindow method generally begins with an ideal frequency response:is the corresponding impulse response sequence. Many idealized systems aredefined by piecewise-constant or piecewise-functional frequency responses with discontinuitiesat the boundaries between bands. As a result, they have impulse response that are noncausal and infinitely long. Window method truncates the infinitely long impulse response by multiplying itwith a finite sequence called the window functions:h(n) h (n) (n) d (2)The Fourier transform of the FIR filter is then given by:(3)which is the periodic convolution of the desired ideal frequency response with the Fouriertransform of the windows. Hence, ( )j H e will be a smeared version of ( )jd H e . The mostpopular window functions being the Kaiser window:(4)where M / 2 , and 0I represents the zeroth-order modified Bessel function of the first kind.The design procedure involves the determination of the order M and the shape parameter from the given specification. Letmin{ , } 1 2 s p (for lowpass approximation)where 1 2 , are respectively the pass and stop band ripples in the specification. s p, are respectively the stop and pass band edge frequencies.DefineA 20log10 (5)Kaiser determined empirically that the value of and M needed to meet the specification isgiven by:Similar procedure can be applied to design multiband filters.4.2 Parks-McClellan methodThe Parks-McClellan algorithm uses the Remez exchange algorithm and Chebyshevapproximation theory to design filters with optimal error norm, i.e. the maximum errorbetween the desired frequency response and the actual frequency response is minimized. Filterdesigned in this way exhibit an equiripple behavior in their frequency response.Unlike the Kaiser window method, the pass and stop band ripples need not be the same. Kaiserhas obtained the following simplified formula for the estimation of filter order for a givenspecification: 4.3 Convex programming methodOptimization toolbox: The problem mentioned above can be solved using a free Matlab toolbox“CVX”, which is available athttp://cvxr.com/cvx/downloadInstall the CVX toolbox according to the descriptions therein.Background:In FIR filter design, the following minimax problem is commonly encountered:where h(n) is the filter coefficients to be determined, is the frequency interval of interest,( )j H e is the frequency response of the FIR filter given by is the ideal frequency response. Typical ideal frequencyresponses of lowpass and highpass FIR filters are respectively given bywhere is the group delay of the FIR filter, and p and s are the passband and stopbandedges, respectively.4.4 PC-MATLABPC-MATLAB is an interactive environment for high level simulation of general numericalapplications such as numerical linear algebra, signal processing, etc.MATLAB works with essentially only one kind of object, a rectangular numerical matrix withpossibly complex elements. Refer to PC-MATLAB Reference and Tutorial for more details ofmatrix declaration and manipulation.User defined function or command files can be added to MATLAB’s vocabulary if they areexpressed in terms of other existing functions. The commands and functions that comprise thenew function are put in a file whose name defines the name of the new functELEC6026代写、代做Digital Signal、代写ion, with a file typeof .m appended. See the PC-MATLAB reference pp.3-84-3.85 for details. M-files can be created using ordinary text-editor and placed in the same directory of MATLAB or other defined searchpath in MATLAB. Type the name of the M-file in MATLAB environment will invoke thecommands or functions defined in the corresponding M-file.In this experiment, we shall make use of two functions in the Signal Processing Toolbox in thePC-MATLAB for designing linear phase FIR filters.fir1 implements the classical method of windowed linear-phase FIR digital filter design. It isformulated to design filters in standard lowpass, bandpass, highpass and bandstop configurations.For exampleb=fir1(n,Wn,kaiser(n+1,β))Returns row vector b containing the n+1 coefficients of the order n Kaiser windowed lowpasslinear-phase FIR filter with normalized cutoff frequency Wn. Refer to MATLAB SignalProcessing Toolbox Tutorial pp. 1-32 - 1-33 and 2-61 - 2-62 for more details.remez is a function to design linear phase FIR filters using the Parks-McClellan algorithm.b=remez(n,f,m,w)returns row vector b containing the n+1 coefficients of the order n FIR filter whose frequencymagnitudecharacteristics match those given by vector f and m. For later versions of theMATLAB, the remez function is replaced by firpm. The usage of firpm is similar to that of theremez functionb=firpm(n,f,m,w)f is a vector of frequency points, specified in the range between 0 and 1, where 1.0 correspondsto half the sample frequency.m is a vector containing the desired magnitude response at the points specified in f. The elementsof m must appear in equal-valued pairs.w is the weight used in each frequency band.Refer to pp. 1-34 - 1-35 and 2-91 - 2-93 of the Signal Processing Toolbox tutorial or the onlinehelp manual of the PC-MATLAB for more details. 5. ProcedureThe assignment package ‘ass1.zip’ contains the following files: ass1_main.m: This script is used to calculate and display the spectrogram of the syntheticsignal which is stored in Signal.mat. The script will load a variable named ‘x’, which isa signal. The total duration of the signal is 2 seconds and the sampling rate is 200 Hz. stft.m: In-house MATLAB scripts to perform STFT. fir_type2_hp_cvx.m: This script is to design a type-II FIR linear-phase highpass filterwith the ideal frequency response in (12) and the following specifications: (a) N 31. (b) s 0.6 and p 0.8 . (c) (N 1)/ 2 15 . (d) Coefficient symmetry: h(n) h(N 1 n) , n 0,1,...,N .(i) Run ass1_main.m to display the synthetic signal and the STFT-based spectrogramusing the default setting (window length = 0.3s). From the signal and its spectrogram,comment on the properties of the signal and identify the frequency of the signal att 0,1 and 2 s.(1 marks)(ii) Re-calculate the spectrogram using the in-house program stft with different windowsizes: 0.2 and 0.5. Modify the MATLAB code in ass1_main.m to plot the twospectrograms. Describe the difference between these spectrograms. Discuss how thewindow size affects the time and frequency resolutions of the spectrograms.(2 marks)(iii) Use the function fir1 in MATLAB to design an FIR lowpass filter using KasierWindow method with the following specifications: 0.6, p 0.7, s 0.001, 1 and 0.01, 2 (13)Obtain the estimate of the filter from eqn. (5) – (7).(1 marks)(iv) Use the Parks-McClellan method (function firpm in MATLAB) to design a lowpass filter with the specification as in (13). Obtain the estimate of the filter from eqn. (8).(1 marks)(v) Plot and discuss the frequency response of filters designed in (iii) and (iv).(1 marks)(vi) Comment on the two approaches in designing linear phase FIR filters.(2 marks)(vii) Use the convex programming method (refer to fir_type2_hp_cvx.m) to design alowpass filter with the same passband and stopband as in (13). Maintain the same ratioof ripples in passband and stopband as in (13). Use the same filter length as calculatedin (iv). Plot its impulse, group delay and frequency responses.(2 marks)(viii) (*)Use the filter designed in (vii) to filter signal ‘x’ by linear convolution.(2 marks)Remarks (*) You are not allowed to use the function conv in MATLAB for yourimplementation. However, you may use it to verify the accuracy of your own code.(ix) Calculate the spectrogram of filtered signal with default window size. Plot the filteredsignal and its spectrogram.(1 marks)(x) Comment and explain the difference between the spectrogram of signal ‘x’ and thefiltered signal.(2 marks)***END***转自:http://www.6daixie.com/contents/12/4439.html