-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_filter.m
41 lines (35 loc) · 869 Bytes
/
test_filter.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
t = points(10, 3, :);
t = squeeze(t);
figure
subplot(2, 1, 1);
plot(t, 'k');
xlabel('Punkt auf dem Bild');
ylabel('x Wert')
t2 = pointsNorm(10, 3, :);
t2 = squeeze(t2);
subplot(2, 1, 2);
plot(t2, 'k')
xlabel('Punkt auf dem Bild');
ylabel('x Wert')
return
samplingRate = 5000;
% Signal parameters:
f = [ 10 40 100 ]; % frequencies
M = 500; % signal length
frames = 10;
x = zeros(frames, M); % pre-allocate 'accumulator'
n = 0:(M-1); % discrete-time grid
for frame=1:frames
% Generate a signal by adding up sinusoids:
for fk = f;
x(frame, :) = x(frame, :) + sin(2*pi*n*fk/samplingRate);
end
x(frame, :) = x(frame, :) + 3;
end
filtered = ideal_bandpassing(x, 2, 30, 50, samplingRate);
plot(n, x(1, :), 'k');
hold all;
plot(n, filtered(1, :), '--k');
xlabel('t')
ylabel('f(t)')
legend('Signal', 'Filter')