-
Notifications
You must be signed in to change notification settings - Fork 1
/
MPD3.m
96 lines (75 loc) · 1.31 KB
/
MPD3.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
clear
clear sound
clc
close all
%Odpowiedz impulsowa filtru
h = [
1873
-4803
2958
2243
-2276
-3502
2157
6475
-2237
-20712
35009
-20712
-2237
6475
2157
-3502
-2276
2243
2958
-4803
1873
]';
%Normalizacja
h = h./max(h);
figure('units','normalized', 'position', [0 0 1 1]);
stem(h); grid; title('Odpowiedź impulsowa mojego filtru'); xlabel('Próbka'); ylabel('Wartość'); axis([0 22 -1 1]);
%% Przypadek 1: delta Kroneckera przez odpowiedz impulsowa
close all;
clc;
x = 1; %Delta Kroneckera
pokaz_odpowiedzi(x,h);
close all;
clc;
%% Przypadek 2: dwie delty Kroneckera oddalone od siebie
x = [1 0 0 0 0 0 0 1];
pokaz_odpowiedzi(x,h);
close all;
clc;
%Omówić ten przypadek poraz drugi
%% Przypadek 3: sinus wolny
x = sin((1:50)/2);
pokaz_odpowiedzi(x,h);
clc
close all
%% Przypadek 3 raz jeszcze z widmem
%Pokazać to samo w abletonie
x = sin((1:50)/2);
pokaz_odpowiedzi2(x,h);
clc
close all
%% Przypadek 4: sinus szybki
x = sin((1:50)*1.75)*0.35;
pokaz_odpowiedzi2(x,h);
clc
close all
%% Pokaz nowej odpowiedzi
h = sin((1:125)/1.75)*0.5;
stem(h); grid; title('Odpowiedź impulsowa mojego filtru'); xlabel('Próbka'); ylabel('Wartość');
axis([0 inf -1 1]);
%% Przypadek 1: inny sinus
x = sin((1:50)*2.8)*0.35;
pokaz_odpowiedzi2(x,h);
clc
close all
%% Przypadek 2: SZUM
x = randn(1,200) .* 0.1;
pokaz_odpowiedzi2(x,h);
clc
close all;