FFT-based Spectrum Tool
Write a MATLAB function to compute FFT of a signal and return frequency and magnitude spectrum. Normalize magnitude.
Constraints
- Function signature: [f,mag]=spec(x,Fs)
- Use fft.
- Use abs.
- Single-sided spectrum.
- mag normalized to max=1.
1function [f,mag] = spec(x,Fs)2% TODO3end