-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfft8pt.m
42 lines (37 loc) · 1.02 KB
/
fft8pt.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
clear;
x=[ 2 -1 1 3 -2 1 2 0];
subplot(2,2,1)
stem(x,'b','filled');
grid on;
axis([0 9 -3 4 ]);
title({'Sequence X(n): ';num2str(x)});
xlabel('Sample Number (n)')
ylabel('Value');
y=fft(x,8);
real_y=real(y);
imag_y=imag(y);
subplot(2,2,2)
stem(real_y,'o','filled');
grid on;
axis([0 9 min(real_y)-1 max(real_y)+1]);
title({'Real part of 8-point DFT: ';num2str(round(real_y*10)/10)});
xlabel('Sample Number (n)')
ylabel('Value of Real part');
plot3=subplot(2,2,3)
stem(imag_y,'o','filled');
plot3.XTickMode='auto';
grid on;
axis([0 9 min(imag_y)-1 max(imag_y)+1]);
title('hooola')
title({'Imaginary part of 8-point DFT of Sequence X(n) ';num2str(round(imag_y*10)/10)});
xlabel('Sample Number (n)')
ylabel('Value of Imaginary part ');
inverse_y=ifft(y,8);
plot4=subplot(2,2,4)
stem(inverse_y,'o','filled');
grid on;
axis([0 9 min(inverse_y)-1 max(inverse_y)+1]);
title({'IInvesre of 8-point DFT: ';num2str(round(inverse_y*10)/10)});
xlabel('Sample Number (n)')
ylabel('Value ');
print('DFT_sequence','-dpng');