Question: Using matlab 1) Explain your observations in (b) and (c) by considering the problem of sampling a harmonic signal. 2) Explain why the reconstructions in
Using matlab
1) Explain your observations in (b) and (c) by considering the problem of sampling a harmonic signal.
2) Explain why the reconstructions in (d) are expected to be more distorted than those at the same sampling rate in (b), even though the fundamental frequency in (d) is less than that in (b)
(a). Generate a "time axis" sequence (t) with 512 values and a data sequence (x) of 512 values containing 8 cycles of a sine wave.
t=[0:511]*2*pi/512;
x=sin(t*8);
plot(t,x);
(b). Calculate the sub-sampling interval corresponding to the "Nyquist rate" for the signal generated in (a) (ie the interval required to ensure two samples per cycle of the signal) and observe the effects of sampling above this rate by setting T to half this value and using the shannon(x,t,T) command..
(c). Repeat (b) for sampling at the Nyquist rate and below the Nyquist rate: (set T to the value calculated in (b) and then to 3/2 times this value).
script for the shannon command:
function y = shannon(x,t,T)
%
% y = shannon(x,t,T)
%
% Reconstruct a band-limited approximation to the signal in x after
% subsampling at intervals T (samples).
% t is the time axis array
%
N = length(x);
if N == 0;
error('Invalid input array');
end
y = recon(x,T);
%
% plot original and reconstruction on same axes
%
M = length(t);
if M < 2;
t = linspace(0,1,N);
elseif M < N;
t = linspace(t(1),(N-1)*t(M)/(M-1),N);
end
x1 = x([1:T:N]);
t1 = t([1:T:N]);
figure(1)
plot(t,x,'r',t,y,'g',t1,x1,'ob');
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
