M=3;
% Factor for up and down sampling
N = length(h);
p = zeros(N,1); % Define a vector of all zeros
p(1:M:N)=1; % Set every third sample to one
As shown above, the upsampled time-domain sequence passes through
the samples of the original signals. This is achieved using a gain
of 3 in the low pass filter. You can see the gain of three in the
frequency domain. Note that the low-pass filter will cause a delay
in the upsampled signal reltive to the original signal. In the figure
above, the delay has been removed.
[y,fs,nbits]=wavread('y.wav');
This loads three variables into you Matlab workspace: y is the
audio data, fs
is the sample rate (11025 in this case), and nbits is
the number of bits used to represent each sample in y.
where these frequencies are discrete-time f requencies in units of rads.
If you would rather use units that are consistent with the way that
we generate our plots, then divide the inequality above by a factor of (2
pi) leading to the following constraint on the carrier frequency.
wavwrite(yr,fs,nbits,'yr.wav');