Question: Matlab problem 2: Calculation of the DFT. In this problem you will measure the execution time and the number of floating point operations (flops) of

 Matlab problem 2: Calculation of the DFT. In this problem youwill measure the execution time and the number of floating point operations

Matlab problem 2: Calculation of the DFT. In this problem you will measure the execution time and the number of floating point operations (flops) of a direct calculation of the DFT using three different organizations of the algorithm. The definition of the DFT is given by: N-1 X[k] = { w[n]Wmk (1) n=0 Wy = e-j2A/N for cos(21/N) jsin(27/N) and k = 0, 1, ...N 1. (a) Two-Loop Program. Write a program (M-file) or a function in MATLAB to evaluate the DFT given above using two nested for loops with the inner loop summing over n and the outer loop indexing over k. Time the program for several lengths using the clock and etime commands. Evaluate the number of flops required for several lengths. Compare the times and flops of your DFT program with the built-in MATLAB command fft for the same lengths. Comment on the results. (b) One-Loop Program. Write a DFT program using one loop which steps through each value of k and executes an inner product. Time the program and evaluate the number of flops as was done in (a). Explain the results obtained. (c) No-Loop Program. Write a DFT program using a single matrix multiplica- tion. Write your own DFT matrix rather than using the built-in dftmtx. Use the exp command with the exponent formed by an outer product of a vector of n = 0: (N-1) and a vector of k = 0:(N-1). Time and evaluate the flops as you did for the previous programs. (d) Comment on the differences and on the comparisons of the three implemen- tations. How many flops are used in generating the complex exponentials? Matlab problem 2: Calculation of the DFT. In this problem you will measure the execution time and the number of floating point operations (flops) of a direct calculation of the DFT using three different organizations of the algorithm. The definition of the DFT is given by: N-1 X[k] = { w[n]Wmk (1) n=0 Wy = e-j2A/N for cos(21/N) jsin(27/N) and k = 0, 1, ...N 1. (a) Two-Loop Program. Write a program (M-file) or a function in MATLAB to evaluate the DFT given above using two nested for loops with the inner loop summing over n and the outer loop indexing over k. Time the program for several lengths using the clock and etime commands. Evaluate the number of flops required for several lengths. Compare the times and flops of your DFT program with the built-in MATLAB command fft for the same lengths. Comment on the results. (b) One-Loop Program. Write a DFT program using one loop which steps through each value of k and executes an inner product. Time the program and evaluate the number of flops as was done in (a). Explain the results obtained. (c) No-Loop Program. Write a DFT program using a single matrix multiplica- tion. Write your own DFT matrix rather than using the built-in dftmtx. Use the exp command with the exponent formed by an outer product of a vector of n = 0: (N-1) and a vector of k = 0:(N-1). Time and evaluate the flops as you did for the previous programs. (d) Comment on the differences and on the comparisons of the three implemen- tations. How many flops are used in generating the complex exponentials

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!