You are on page 1of 3

1

PRACTICAL:-8
AIM:- TO IMPLEMENT SAMPLING AND RECONSTRUCTION OF SINE WAVE.

CODE:-
clear,clc,close all;

F = 30; Fs
= 2*F;
Ts = 1/Fs;
tc = 0:1e-4:5/F;
xc = cos(2*pi*F*tc);td
= 0:Ts:5/F;
xd = cos(2*pi*F*td); N = length(td);

xr = zeros(size(tc));
sinc_train = zeros(N,length(tc));for
t = 1:length(tc)
for n = 0:N-1
sinc_train(n+1,:) = sin(pi*(tc-n*Ts)/Ts)./(pi*(tc-n*Ts)/Ts); xr(t) =
xr(t) + xd(n+1)*sin(pi*(tc(t)-n*Ts)/Ts)/(pi*(tc(t)-
n*Ts)/Ts);
end
end

figure hold
on grid on
plot(tc,xc)
stem(td,xd)
plot(tc,xr)

GAURAV (19162151005)
2

xlabel('Time [sec]')
ylabel('Amplitude')

figure
hold on
grid on
plot(tc,xd.'.*sinc_train)
stem(td,xd) xlabel('Time
[sec]')
ylabel('Amplitude')

OUTPUT:

GAURAV (19162151005)
3

GAURAV (19162151005)

You might also like