DSP-LAB-2-Task: Submitted By: Shazir Ali Khan REG NO # SP18-BTN-004 SUBMITTED TO: Maam Zenab Fazal

You might also like

You are on page 1of 6

DSP-LAB-2-Task

SUBMITTED BY: SHAZIR ALI KHAN


REG NO # SP18-BTN-004
SUBMITTED TO: Maam Zenab Fazal
DATE: 26 August, 2020
LAB TASK:

fn=3; % Using frequencies 3 and 100


fs=100;
t=-1:1/fs:1;
x=sin(2*pi*fn*t);
plot(t,x)
xlabel('t')
ylabel('amp')
title('x(t)')
axis([0 1 -1 1])

Figure:

Xjw=fftshift(fft(x,fs));
om=linspace(-fs/2,fs/2,fs);
plot(om,abs(Xjw))

Figure:
s=square(2*pi*2*fn*t);
impT=abs(diff(s))/2;
plot(t(1:length(t)-1),impT)

Figure:

samp=x(1:length(impT)).*(impT);
stem(samp)
Figure:

fn=35; % Using frequencies 35 and 200


fs=200;
t=-1:1/fs:1;
x=sin(2*pi*fn*t);
plot(t,x)
xlabel('t')
ylabel('amp')
title('x(t)')
axis([0 1 -1 1])

Figure:
Xjw=fftshift(fft(x,fs));
om=linspace(-fs/2,fs/2,fs);
plot(om,abs(Xjw))

Figure:

s=square(2*pi*2*fn*t);
impT=abs(diff(s))/2;
plot(t(1:length(t)-1),impT)

Figure:

samp=x(1:length(impT)).*(impT);
stem(samp)

Figure:

You might also like