I had to compute the DFT of a signal with 5 points with a hand-written method and using MATLAB's FFT just to see if they are equal. Taking the absolute value of both gives the same spectrum, however the conjugates are in a different order for both. Why is this?
values using handwritten DFT, negative conjugates first
values using MATLAB FFT, positive conjugates first
The code I used is shown below
Now we compute the DFT of the finite sequence to show that DFT is
actually a sampled version of the DTFT.
N=5;
W=exp(-1i*2*pi/N); %the complex term W_N defined in lecture 2;
DFTmatrix = W.^((0:N-1)'*(0:N-1)); %the DFT matrix of size N
%Multiply the DFT matrix with the time-domain samples to get DFT
DFTofTruncatedSampledSignal = DFTmatrix*sampledsignal.';
Task 5:
FFTSpectrum =fft(sampledsignal,N)'; %MATLAB fft function to compute DFT