Code covered by the BSD License  

Highlights from
MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

image thumbnail

MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

by

 

29 Oct 2012 (Updated )

These files are the MatLab solutions of exercises contained in the above DSP lab textbook.

fraction_sample(x,h,M,N)
function y = fraction_sample(x,h,M,N)
% Fractional Sampling Rate Conversion function by a factor of M/N.
%
% Inputs:
% x : this is a vector containing the input sequence to be fractionaly sampled .
% h : this is the lowpass filter with gain M and cutoff frequency pi/max(M,N) rad.
%      The filter kernel h is assumed to be designed externally to meet those specs.
% M : Upsampling factor.
% N : Downsampling factor.

% First upsample x[n] by a factor of  M.
r = my_upsample(x,M);

s = conv(h,r); % Filter the sequence r[n] using the given low-pass filter h.

% Finally, downsample by a factor of N:
y = my_downsample(s,N);

Contact us