Code covered by the BSD License  

Highlights from
Sample rate conversion

from Sample rate conversion by Kirty Vedula
Convert sample rates at ease using GUI Lite 2.5

srconv(x,fsin,fsout)
function [y] = srconv(x,fsin,fsout)
%
% function to convert sampling rate from one sampling rate to another
% so long as the sampling rates have an integer least common multiple
%
% Inputs:
%   x: input signal at rate fsin
%   fsin: sampling rate on input
%   fsout: new sampling rate on output
%
% Output:
%   y: output signal at sampling rate fsout
%
% determine m, the least common multiple (lcm) of fsin and fsout
    m=lcm(fsin,fsout);
    
% determine the up and down sampling rates
    up=m/fsin;
    down=m/fsout;
    
% resample the input using the computed up/down rates
    y=resample(x,up,down);

end

Contact us