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

1 Answer 1

3
$\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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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