Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB: how do I find a single line anonymous function for this problem? The N-p

ID: 1716770 • Letter: M

Question

MATLAB: how do I find a single line anonymous function for this problem?

The N-point DFT X_k of a length-N signal x_n can be expressed in matrix form. X_k _n=0 ^n-1 x_ne^-2pijkm/N k = 0,1,...,N- 1 where x. X are the Ar-dimensional column vectors of the time samples and DFT values, and A is the DFT matrix of size n x n, with matrix elements, A_kn =e^2pijkn/N 0 k N -1, 0 n N - 1 a. Write a single-line anonymous MATLAB function of N, called dftmat, that defines the DFT matrix of Eq. (7), and has syntax, A = dftmat(N); where your anonymous definition should begin with, dftmat = (N)...

Explanation / Answer

function A = dftmat(N)
A =zeros(N);
for n = 0:N-1
    for k =0:N-1
        A(k,n)=exp((-1i.*2.*pi.*n.*l)./N);
    end
end