FFT Spectrum Analyzer

Medium MATLAB DSP
Solve this problem

Compute the magnitude spectrum of a real-valued vector using FFT.

Constraints

  • Input vector must be 1D.
  • Use abs() on FFT output.
  • Return only first half of spectrum.
  • No loops allowed.
Starter codeMATLAB
1function mag = spectrum(x)2% TODO3end