Question
This is the code: function y = shannon(x,t,T) % % y = shannon(x,t,T) % % Reconstruct a band-limited approximation to the signal in x after
This is the code:
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 %
t= [0:511]*2* pi / 512; x = sin(t *8); plot(t, x); 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');
These are the tasks :
(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). Question 4: Explain your observations in (b) and (c) by considering the problem of sampling a harmonic signal. (15%) (d). Generate a 4-cycle square wave in x, and use shannon(x,t,T) to observe the effect of various sampling rates. (Hint: To construct the square wave : r = [ones(1,64) zeros(1,64)]; x = [r r r r];) Question 5: 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). (15%) (e). Read in the data for a single cycle of blood flow velocity (type the command bv; the data will be placed in the x array). Observe the effect of sub-sampling and reconstruction at a range of sample intervals using the shannon command.
I am stuck at how to change T value, how to calculate nyquist rate and what is the use we make of initials shannon (x,t,T)
Thank you for help.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started