[go: up one dir, main page]

0% found this document useful (0 votes)
41 views7 pages

Lab Tasks Answer No. 01) :-: Code in Command Window

The document contains code to perform FFT on various signals in MATLAB and analyze them in the time and frequency domains. In part A, it performs FFT on a delta function and plots the result. Part B performs FFT on a cosine signal. Part C performs FFT on a sinc function. It also contains code for an IIR filter and plotting the phase of FFT outputs. Comments indicate that fast signals have high frequencies near pi in the frequency domain while slow signals have high frequencies near zero.

Uploaded by

Muhammad Anas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views7 pages

Lab Tasks Answer No. 01) :-: Code in Command Window

The document contains code to perform FFT on various signals in MATLAB and analyze them in the time and frequency domains. In part A, it performs FFT on a delta function and plots the result. Part B performs FFT on a cosine signal. Part C performs FFT on a sinc function. It also contains code for an IIR filter and plotting the phase of FFT outputs. Comments indicate that fast signals have high frequencies near pi in the frequency domain while slow signals have high frequencies near zero.

Uploaded by

Muhammad Anas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

LAB TASKs

Answer no. 01):-

Code in command window:-


clc;
clear all;
close all;
n=0:10;
x=zeros(1,length(n));
x(1,2)=1;
y = fft(x);
figure;
subplot(211);
stem(x);
title('in TIme Domain')
subplot(212);
plot(abs(y))
axis([1,10,0,1.5])
title('In frequency Domain')

PART B
clc;
clear all;
close all;
% fs=12;

Digital Signal Processing Lab Page 1


n=0:1/6:11;
x=cos(2*pi*n);
y=abs(fft(x));
subplot(211);
stem(n,x);
title('in TIme Domain')
subplot(212);
plot(y)
title('In frequency Domain')

PART C
clc;
clear all;
close all;
n=0:1/100:20;
x=sinc(n);
figure;
subplot(211);
stem(x);
title('In time domain');
Y=(fft(x));
subplot(212);
% axis([0,10,0,1]);
plot(abs(Y));
% axis([0,10,0,1]);

Digital Signal Processing Lab Page 2


Answer no. 02):-
COMMENTS;;
In the fast signal in time have high frequency near to pi
and similarly in the slow signal in time have high
frequency near to zeros

Digital Signal Processing Lab Page 3


Answer no. 03):-
Code in command window:-
clc;
clear all;
close all;
n=0:10;
a = [8 -2 -1]; % left hand side of difference
equation
b = [1 1 0]; % right hand side of difference
equation
x=2.^n;
z=filter(b,a,x);
figure;
subplot(211)
stem(n,z);
title('IIR in time Domain');
y=abs(fft(z));
subplot(212);
plot(n,y);
title('IIR in frequency Domain');

Digital Signal Processing Lab Page 4


Answer no. 04):-
Code in command window:-
clc;
clear all;
close all;
n=0:10;
x=zeros(1,length(n));
x(1,2)=1;
y = fft(x);
figure;
subplot(211);
stem(x);
title('in TIme Domain')
subplot(212);
plot(phase(y))
% axis([1,10,0,1.5])
title('In frequency Domain')

clc;
clear all;
close all;
% fs=12;
n=0:1/6:11;
x=cos(2*pi*n);

Digital Signal Processing Lab Page 5


y=phase(fft(x));
subplot(211);
stem(n,x);
title('in TIme Domain')
subplot(212);
plot(y)
title('In frequency Domain')

Digital Signal Processing Lab Page 6


clc;
clear all;
close all;
n=0:1/100:20;
x=sinc(n);
figure;
subplot(211);
stem(x);
title('In time domain');
Y=(fft(x));
subplot(212);
plot(phase(Y));

Digital Signal Processing Lab Page 7

You might also like