Source: https://ewh.ieee.org/r1/ct/sps/PDF/MATLAB/chapter8.pdf