Professional Documents
Culture Documents
in (VP)
www.vidyarthiplus.in
Thanks to:
Ganesh Murthy
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
b=
0.0971
0.1941
0.0971
1.0000 -0.9463
0.3346
a=
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
b=
0.0971
0.1941
0.0971
1.0000 -0.9463
0.3346
a=
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
www.Vidyarthiplus.in (VP)
subplot(3,3,5);
stem(t,b);
xlabel('time');
ylabel('Amplitude');
title ('sawtooth wave');
% unit step signal
n=-5:5;
a = [zeros(1,5),ones(1,6)];
subplot(3,3,6);
stem(n,a);
Xlabel ('time');
Ylabel ('amplitude');
title('Unit step');
% unit impulse
n=-5:5;
a = [zeros(1,5),ones(1,1),zeros(1,5)];
subplot(3,3,7);
stem(n,a);
Xlabel ('time');
Ylabel ('amplitude');
title('Unit impulse');
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
CALCULATION OF FFT:
function[Xk]=dft(x,N);
x=[1 1 1 1 4 5 6 1];
N=8;
n=[0:1:N-1];
k=[0:1:N-1];
a=(-i*2*pi/N);
WN=exp(a);
nk=n'*k;
WNnk=WN.^nk;
Xk=x*WNnk
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Columns 5 through 8
4.0000 + 0.0000i -0.1716 + 2.1716i -2.0000 + 4.0000i -5.8284 - 7.8284i
ans =
Columns 1 through 4
20.0000
Columns 5 through 8
4.0000 + 0.0000i -0.1716 + 2.1716i -2.0000 + 4.0000i -5.8284 - 7.8284i
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
0.3185
0.5093
0.3178 -0.0095
0.2905
0.5093
0.2899 -0.0065
Columns 9 through 11
-0.1056
0.0094
0.0630
hn =
Columns 1 through 8
0.0050
Columns 9 through 11
-0.0420
0.0016
0.0050
hn =
Columns 1 through 8
0
0.2881
0.5093
0.2875 -0.0062
Columns 9 through 11
-0.0365
0.0009
hn =
Columns 1 through 8
-0.0000
0.2705
0.5093
0.2699 -0.0049
Columns 9 through 11
-0.0212
0.0004 -0.0000
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
0.1061
0.0085 -0.3175
0.4907 -0.3188
0.0100
0.0058 -0.2896
0.4907 -0.2908
0.0068
Columns 9 through 11
0.1053 -0.0091 -0.0632
hn =
Columns 1 through 8
-0.0050 -0.0016
0.0422
Columns 9 through 11
0.0419 -0.0015 -0.0051
hn =
Columns 1 through 8
0 -0.0009
0.0366
0.0056 -0.2872
0.4907 -0.2884
0.0066
Columns 9 through 11
0.0364 -0.0009
hn =
Columns 1 through 8
0.0100
0.0001
0.0350
0.0055 -0.2539
0.4122 -0.2550
0.0064
Columns 9 through 11
0.0348
0.0001
0.0101
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
clc;
Wc1=input('enter the value of Wc1=');
Wc2=input('enter the value of Wc2=');
N=input('enter the value of N=');
alpha=(N-1)/2;
eps=0.001;
%Rectangular Window
n=0:1:N-1;
hd=(sin(Wc1*(n-alpha+eps))-sin(Wc2*(n-alpha+eps)*pi))./((n-alpha+eps)*pi);
hn=hd
W=0:0.01:pi;
h=freqz(hn,1,W);
plot(W/pi,abs(h));
hold on;
%Hamming Window
n=0:1:N-1;
Wn=0.54-0.46*cos((2*pi*n)/(N-1));
hn=hd.*Wn
W=0:0.01:pi;
h=freqz(hn,1,W);
plot(W/pi,abs(h),'green');
hold on;
%Hanning Window
n=0:1:N-1;
Wn=0.5-0.5*cos((2*pi*n)/(N-1));
hn=hd.*Wn
W=0:0.01:pi;
h=freqz(hn,1,W);
plot(W/pi,abs(h),'red');
hold off;
%Blackman Window
n=0:1:N-1;
wh=042-0.5*cos((2*pi*n)/(N-1))-0.08*cos((4*pi*n)/(N-1));
hn=hd.*wh
w=0:0.01:pi;
h=freqz(hn,1,w);
plot(W/pi,abs(h),'green');
hold off;
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
hn =
Columns 1 through 8
-0.0639
0.0272 -0.0314
0.0566
0.5616 -1.0976
0.5617
0.0575
0.0386
0.5123 -1.0976
0.5123
0.0393
Columns 9 through 11
-0.0323
0.0268 -0.0633
hn =
Columns 1 through 8
-0.0051
0.0046 -0.0125
Columns 9 through 11
-0.0129
0.0045 -0.0051
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
hn =
Columns 1 through 8
0.0026 -0.0108
0.0370
0.5080 -1.0976
0.5081
0.0377
Columns 9 through 11
-0.0112
0.0026
hn =
Columns 1 through 8
-2.6472
1.1293 -1.3160
2.4297
Columns 9 through 11
-1.3548
1.1148 -2.6228
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
hn =
Columns 1 through 8
0.0528
0.6325 -1.0544
0.6314
0.0538
0.0360
0.5770 -1.0544
0.5760
0.0367
Columns 9 through 11
-0.1986 -0.0505
0.1055
hn =
Columns 1 through 8
Columns 9 through 11
-0.0790 -0.0085
0.0084
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
hn =
Columns 1 through 8
0 -0.0048 -0.0686
0.0346
0.5721 -1.0544
0.5711
0.0352
Columns 9 through 11
-0.0686 -0.0048
hn =
Columns 1 through 8
-0.0169
0.0005 -0.0656
0.0338
0.5059 -0.8857
0.5050
0.0344
Columns 9 through 11
-0.0656
0.0005 -0.0169
Powered by VidyarthiPlus.in
www.Vidyarthiplus.in (VP)
Powered by VidyarthiPlus.in