<< Chapter < Page Chapter >> Page >

Matlab simulation

Using your results from the previous part, simulate the two-stage multi-rate filter in MATLAB. Plot the frequencyresponse of each stage's filter using freqz and determine the overall frequency response of your multi-rate system to verify thatit meets the specifications. Since there is not a command for directly finding the frequency response plot of amulti-rate system in MATLAB, you will have to be a bit creative.

Additional questions (optional, but for your benefit)

  • Does it make a difference in which order the two decimations are done in a two-stage implementation?
  • Could / would you add additional stages? Why or why not?
  • Are quantization effects more or less pronounced in the multi-stage implementation compared to a directimplementation? Why or why not?

Fourier-based filtering methods

It is possible to perform linear convolution quickly using the FFT. This idea allows for the efficient implementation of aFIR filter when the number of filter coefficients and the length of the input sequences are large.

Questions

  • Read Lecture 49 of the ECE 310 Course Notes on "Block Convolution." This lecture provides an excellent overviewof two methods for efficiently performing convolution using the FFT: "Overlap and Add" and "Overlap and Save." For amore in depth treatment of these methods, refer to Discrete-Time Signal Processing by Alan Oppenheim and RonaldSchafer.
  • Simulate both an (1) overlap and add and an (2) overlap and save filtering implementation in MATLAB. Yoursimulations should work for any choice of an FIR filter. The filter length M and block length L should be variableparameters.
  • Verify that your simulated systems are working properly by comparing their performance with a direct FIRimplementation. Test using several FIR filter designs and appropriate test inputs.
  • Derive expressions for the amount of computation (in terms of multiply accumulates) required per input sample forboth the overlap and add and overlap and save implementations. Plot the computation per sample as afunction of the input block length (for a particular filter size M) for both schemes. Is there a value of M for whichthe Direct FIR is always more efficient? Derive an expression for the optimal block size L in terms of thefilter length M for both implementations.
  • In the DSP implementation, the input sequence is purely real. The values of the imaginary components are allset to zero. We can speed up the implementations further by exploiting the symmetry properties of the Fourier transform.These properties are stated as follows:
    DFT x n Even X ω
    DFT j x n Odd X ω
    Using these properties, determine how to get two FFT's for the price of one. Implement this scheme in MATLAB, andverify that the operation is correct.
  • Design a FIR filter that meets the filter specification given in the filter specification . Lecture 38 of the ECE 310 notes on "Parks-McClellan" might be a good reference here. Design an efficient implementation of this filterusing the methods you explored above. The MATLAB commands remezord and remez may be of great help. Simulate this implementation in MATLAB, programming in such a way that you can easilyconvert your MATLAB simulation to assembly. Find the number of computations per input for your method.
  • What are the benefits and trade-offs of using the Fourier-based method in terms of accuracy of the filterspecification, finite precision errors, and computational expense? Compare with the IIR and multi-rate filterimplementations.

Be prepared to show all the necessary plots and MATLAB simulations as well as answers to all of the questions posedabove to your T.A. as your prelab.

Implementation issues

Due to the limitations of the core file, it is not possible to take in more than 64 input samples from the A/D converterat a time (unless the core file is rewritten to accomplish this task). Therefore, when implementing a Fourier-basedfilter, you should use the C skeleton from Lab 4 to perform the FFT on a large block of samples. All of your filteringoperations (i.e., the multiplications of DFT samples, the additions of the overlap, the discarding of samples) andfunction calls must be performed in assembly. You will be graded on the number of cycles per input sample based on theportion of code in your assembly routine.

You should use the fft.asm routine provided in Lab 4 to perform the forward and reverse FFT's.You should study this file to determine how it works. If you need to change the length of the FFT, you will firstneed to change the relevant parameters in your assembly file (i.e., N , K_FFT_SIZE , K_LOGN , and other variables). You will also need to change the following parameters in the FFTfile:

K_TWID_TBL_SIZE K_TWID_IDX_3

K_TWID_TBL_SIZE is the size of the twiddle tables (how long should these be for a given FFTlength?) and K_TWID_IDX_3 is the amount by which the program increments through the twiddletable during at the third stage of the FFT. What is this increment for a given N ? Is fft.asm a decimation in time or decimation in frequency algorithm?

You will also need a modified twiddle table when you change the length of the FFT to use fft.asm as written. For a length 1024 FFT, the twiddle tables arelength 512 each. TWIDDLE1 is a table of sine values from zero to π , and TWIDDLE2 is a table of cosine values from π 2 to 2 . The support for the cosine and sine is different because fft.asm code uses the fact that θ θ when performing computations. If you want a length 64 FFT, you will need to ``decimate'' the twiddle table to length32, or in other words, only keep one out of every 16 lines in the twiddle tables and discard the rest. We will providea MATLAB function, edit_twiddle.m for this purpose. The function call in this example would be:

edit_twiddle('TWIDDLE1','new_twiddle1',16)

You should verify that the new twiddle tables you generate indeed have 32 elements. To perform an inverse FFT, you canuse the standard FFT algorithm and then appropriately scale and shift the outputs. Lecture 43 of the ECE 310 notes onthe Discrete Fourier Transform suggests how this may be done (Property 3 of ``Properties of the DFT'').

Questions & Answers

A golfer on a fairway is 70 m away from the green, which sits below the level of the fairway by 20 m. If the golfer hits the ball at an angle of 40° with an initial speed of 20 m/s, how close to the green does she come?
Aislinn Reply
cm
tijani
what is titration
John Reply
what is physics
Siyaka Reply
A mouse of mass 200 g falls 100 m down a vertical mine shaft and lands at the bottom with a speed of 8.0 m/s. During its fall, how much work is done on the mouse by air resistance
Jude Reply
Can you compute that for me. Ty
Jude
what is the dimension formula of energy?
David Reply
what is viscosity?
David
what is inorganic
emma Reply
what is chemistry
Youesf Reply
what is inorganic
emma
Chemistry is a branch of science that deals with the study of matter,it composition,it structure and the changes it undergoes
Adjei
please, I'm a physics student and I need help in physics
Adjanou
chemistry could also be understood like the sexual attraction/repulsion of the male and female elements. the reaction varies depending on the energy differences of each given gender. + masculine -female.
Pedro
A ball is thrown straight up.it passes a 2.0m high window 7.50 m off the ground on it path up and takes 1.30 s to go past the window.what was the ball initial velocity
Krampah Reply
2. A sled plus passenger with total mass 50 kg is pulled 20 m across the snow (0.20) at constant velocity by a force directed 25° above the horizontal. Calculate (a) the work of the applied force, (b) the work of friction, and (c) the total work.
Sahid Reply
you have been hired as an espert witness in a court case involving an automobile accident. the accident involved car A of mass 1500kg which crashed into stationary car B of mass 1100kg. the driver of car A applied his brakes 15 m before he skidded and crashed into car B. after the collision, car A s
Samuel Reply
can someone explain to me, an ignorant high school student, why the trend of the graph doesn't follow the fact that the higher frequency a sound wave is, the more power it is, hence, making me think the phons output would follow this general trend?
Joseph Reply
Nevermind i just realied that the graph is the phons output for a person with normal hearing and not just the phons output of the sound waves power, I should read the entire thing next time
Joseph
Follow up question, does anyone know where I can find a graph that accuretly depicts the actual relative "power" output of sound over its frequency instead of just humans hearing
Joseph
"Generation of electrical energy from sound energy | IEEE Conference Publication | IEEE Xplore" ***ieeexplore.ieee.org/document/7150687?reload=true
Ryan
what's motion
Maurice Reply
what are the types of wave
Maurice
answer
Magreth
progressive wave
Magreth
hello friend how are you
Muhammad Reply
fine, how about you?
Mohammed
hi
Mujahid
A string is 3.00 m long with a mass of 5.00 g. The string is held taut with a tension of 500.00 N applied to the string. A pulse is sent down the string. How long does it take the pulse to travel the 3.00 m of the string?
yasuo Reply
Who can show me the full solution in this problem?
Reofrir Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ece 320 - spring 2003. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10096/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 320 - spring 2003' conversation and receive update notifications?

Ask