down convert a signal in matlab

To down convert a signal in Matlab, you can use the following steps:

  1. Load the signal you want to down convert into Matlab.
    main.m
    signal = load('signal.mat');
    
    29 chars
    2 lines
  2. Choose a down conversion factor. This factor should be less than 1 if you want to decrease the frequency of the signal.
    main.m
    downFactor = 0.5;
    
    18 chars
    2 lines
  3. Determine the new sampling frequency that you want to use. This can be calculated as the original sampling frequency divided by the down conversion factor.
    main.m
    Fs_new = Fs * downFactor;
    
    26 chars
    2 lines
  4. Create a low-pass filter to remove frequencies above the new Nyquist frequency.
    main.m
    lpFilter = designfilt('lowpassfir', 'PassbandFrequency', Fs_new/2, 'StopbandFrequency', Fs_new/2*1.1, ...
                           'PassbandRipple', 0.5, 'StopbandAttenuation', 60, 'DesignMethod', 'kaiserwin');
    
    209 chars
    3 lines
  5. Apply the low-pass filter to the original signal using the Matlab function resample.
    main.m
    signal_downconverted = resample(signal, downFactor, 1, 'low');
    
    63 chars
    2 lines

After these steps, the signal_downconverted will be the down converted version of the original signal.

gistlibby LogSnag