Resample Signal Rate Conversion

Medium MATLAB DSP Asked at MediaTek
Solve this problem

Convert a signal between two sample rates by rational resampling, with the anti-alias filtering that makes the result correct rather than merely shorter.

Constraints

  • Function: y = resample_signal(x, fs_in, fs_out).
  • Reduce the ratio to its lowest terms before resampling.
  • Filter at the lower of the two Nyquist frequencies.
  • Preserve signal amplitude.
  • Reject a non-positive sample rate.
  • Report the actual output length.
Starter codeMATLAB
1function y = resample_signal(x, fs_in, fs_out)2% TODO3end