Lab Report # 5: Fourier Transform: It Is A Mathematical Operation That Decomposes A Function Into Its
Lab Report # 5: Fourier Transform: It Is A Mathematical Operation That Decomposes A Function Into Its
Lab Report # 5: Fourier Transform: It Is A Mathematical Operation That Decomposes A Function Into Its
n=0:10;
% defining the variable of n
l=10;
% Defining the length
x=zeros(size(n))
ind=find(n>=0 & n<=1);
x(ind)=1
y=x.*exp(j*pi*n)
subplot(3,2,1)
stem(n,y,'linewidth',2)% Plotting the function
grid on;
title('y=x*exp(j*pi*n)')
xlabel('integral components');
ylabel('amplitude');
w=[-pi:pi/1024:pi]; % Defining the values of w for plottation
yspect=freqz(y,l,w);%As we know that freqz command is used for plotting
%Frequency response of any function. Now here we have to plot y with final
%value of l and plot with respect to w. Here it will only store value to
%yspect.
subplot(3,2,2);
plot(w,abs(yspect),'linewidth',2);% Plotting the magnitude
grid on;
title('w=[-pi:pi/1024:pi]')
xlabel('integral components');
ylabel('amplitude');
phaser=angle(yspect);% Similarly for plotting phase, we will store it to phase
subplot(3,2,3);
plot(w,phaser,'linewidth',2)% Plotting the phase with respect to w
grid on;
title('phaser=angle(yspect)')
xlabel('integral components');
ylabel('amplitude');
w=[0:pi];
yspect1=freqz(y,1,w);
subplot(3,2,4)
plot(w,abs(yspect1),'linewidth',2)% Plotting magnitude spectrum
grid on;
title('w=[0:pi]')
xlabel('integral components');
ylabel('amplitude');
phaser1=angle(yspect1);
subplot(3,2,5);
plot(w,phaser1,'linewidth',2)
grid on;
xlabel('integral components');
ylabel('amplitude');
OUT PUT:
y=x*exp(j*pi*n)
0
-1
4
6
integral components
phaser=angle(yspect)
-2
-4
-3
-2
-1
0
1
integral components
0.5
1
1.5
2
integral components
-3
-2
2
amplitude
0
-4
10
0.1
amplitude
amplitude
w=[-pi:pi/1024:pi]
0.2
amplitude
amplitude
2.5
-1
0
1
integral components
w=[0:pi]
1
0
0.5
1
1.5
2
integral components
2.5