Student Seminar Report & Project Report With Presentation (PPT,PDF,DOC,ZIP)

Full Version: VERIFICATION OF SAMPLING THEOREM
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Procedure: -
1. Select a frequency of ‘f’ Hz
2. To generate a sine wave of F Hz, define a closely spaced time vector(to represent analog signal, at least 1000 samples pr cycle)t=0:1/1000:1;
3. Generate the sinusoid, and plot the signal x_analog=sin(2*pi*F*t)
4. Select a sampling frequency Fs=10Fsamples/sec,generate a suitable time scale for this sampling signal n=0:1/Fs:1;%vector to define the sampling instants
5. Sample the analog signal at the instants specified by ’n ’
x_discreate =sin (2*pi*F*n) plot this using separate subplot and stem
MATLAB program to illustrate sampling theorem
Code:
clc
clear
close all

% SAMPLE A BANDLIMITED CONTINOUS TIME SIGNAL BANDLIMITED TO Fm Hz
% UNDER THE FOLLOWING CONDITIONS
% (i) NYQUIST RATE (ii) TWICE THE NYQUIST RATE (iii) HALF THE NYQUIST RATE
% FIND THE EFFECT IN EACH OF THE ABOVE CASE

f1 = input ('The Frequency of the first sine wave in Hz: ‘);
A1 = input ('Amplitude of first sine wave:');
f2 = input ('The Frequency of the second sine wave in Hz : ' );
A2 = input ('Amplitude of first sine wave:');
fs = input('The sampling frequency in Hz (atleast max(f1,f2)*10) = ');
p = input ('The number periods for display = ');

t = 0:0.000001:p*(1/f1);
xf1 = A1*cos(2*pi*f1*t);
subplot(2,2,1);
plot(t,xf1);
xlabel('Time in Seconds -->');
ylabel('Amplitude -->');
title('Plot of First Cosine Wave');
axis([0 (p*(1/f1)) -1.2 1.2]);
grid on;

xf2 = A2*cos(2*pi*f2*t);
subplot(2,2,2);
plot(t,xf2,'r -',t,xf1);
xlabel('Time in Seconds -->');
ylabel('Amplitude -->');
title('Plot of Second Cosine Wave');
axis([0 (p*(1/f1)) -1.2 1.2]);
grid on;

xsum = xf1+xf2;
subplot(2,2,3);
plot(t,xsum);
xlabel('Time in Seconds -->');
ylabel('Amplitude -->');
title('Plot of Summed Cosine Waves');
axis([0 (p*(1/f1)) -2.2 2.2]);
grid on;

% SAMPLING
ts = 0:1/fs:p*(1/f1);
xs = A1*cos(2*pi*f1*ts) + A2*cos(2*pi*f2*ts);
nt = 0:length(ts) - 1;
subplot(2,2,4)
stem(nt,xs);
axis([0 (length(nt) - 1) -2.2 2.2]);
title('Plot of Sampled Signal');
grid on;

disp(' The number samples generated = ')
nn = p*(fs/max(f1,f2))

RESULT: - VERIFICATION OF SAMPLING THEOREM
The Frequency of the first sine wave in Hz: 10 Amplitude of first sine wave: 1
The Frequency of the second sine wave in Hz: 20 Amplitude of second sine wave: 1
The sampling frequency in Hz = 100
The number periods for display = 5