0
$\begingroup$

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 handwritten DFT, negative conjugates first

values using MATLAB FFT, positive 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 
$\endgroup$
  • $\begingroup$ The matrix multiplication in MATLAB is a complex conjugate multiplication. $\endgroup$ – Dan Boschen Feb 19 at 1:59
  • $\begingroup$ @Dan: No, it is not. $\endgroup$ – Cris Luengo Feb 20 at 17:18
  • $\begingroup$ Ah my mistake- it is the transpose that’s is the complex conjugate. Thanks @CrisLuengo $\endgroup$ – Dan Boschen Feb 20 at 17:21
2
$\begingroup$

I think your problem might be in this line:

FFTSpectrum = fft(sampledsignal,N)';

Note that in MATLAB, ' is the complex conjugate transpose. Use .' to transpose a matrix without applying the complex conjugation.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.