-
Notifications
You must be signed in to change notification settings - Fork 0
/
Oppgave3.m
60 lines (51 loc) · 2.17 KB
/
Oppgave3.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
%FIR 1
h1 = [0.0002, 0.0001, -0.0001, -0.0005, -0.0011, -0.0017, -0.0019, ...
-0.0016, -0.0005, 0.0015, 0.0040, 0.0064, 0.0079, 0.0075, 0.0046, ...
-0.0009, -0.0084, -0.0164, -0.0227, -0.0248, -0.0203, -0.0079, ...
0.0127, 0.0400, 0.0712, 0.1021, 0.1284, 0.1461, 0.1523, 0.1461, ...
0.1284, 0.1021, 0.0712, 0.0400, 0.0127, -0.0079, -0.0203, -0.0248, ...
-0.0227, -0.0164, -0.0084, -0.0009, 0.0046, 0.0075, 0.0079, 0.0064, ...
0.0040, 0.0015, -0.0005, -0.0016, -0.0019, -0.0017, -0.0011, ...
-0.0005, -0.0001, 0.0001, 0.0002];
%FIR 2
h2 = [-0.0002, -0.0001, 0.0003, 0.0005, -0.0001, -0.0009, -0.0007, ...
0.0007, 0.0018, 0.0005, -0.0021, -0.0027, 0.0004, 0.0042, 0.0031, ...
-0.0028, -0.0067, -0.0023, 0.0069, 0.0091, -0.0010, -0.0127, ...
-0.0100, 0.0077, 0.0198, 0.0075, -0.0193, -0.0272, 0.0014, 0.0386, ...
0.0338, -0.0246, -0.0771, -0.0384, 0.1128, 0.2929, 0.3734, 0.2929, ...
0.1128, -0.0384, -0.0771, -0.0246, 0.0338, 0.0386, 0.0014, -0.0272, ...
-0.0193, 0.0075, 0.0198, 0.0077, -0.0100, -0.0127, -0.0010, 0.0091, ...
0.0069, -0.0023, -0.0067, -0.0028, 0.0031, 0.0042, 0.0004, -0.0027, ...
-0.0021, 0.0005, 0.0018, 0.0007, -0.0007, -0.0009, -0.0001, 0.0005, ...
0.0003, -0.0001, -0.0002];
%Frekvensspekter av direkte ankomst
[X1,f1] = frekspekin3190(y1(t > 0.3 & t < 0.8,offset1 == 600),1000,fs);
%Setter opp tukeywin
L = 124;
t1 = tukeywin(L,1);
%Bruker tukeywin på signalet
tukey_y1= y1(t > 0.3 & t < 0.8, offset1 == 600).*t1;
[X_tukey,f_tukey] = frekspekin3190(tukey_y1,1000,fs);
%Plotter direkte ankomst
figure
subplot(2,1,1);
plot(f1,20*log(abs(X1)));
title('Frekvensspekter av direkte ankomst')
xlabel('Frekvens(Hz)')
ylabel('Magnitude(dB)')
subplot(2,1,2);
plot(f_tukey,20*log(abs(X_tukey)))
title('Frekvensspekter av direkte ankomst, med tukeywin')
xlabel('Frekvens(Hz)')
ylabel('Magnitude(dB)')
figure
subplot(2,1,1);
plot(t(t > 0.3 & t < 0.8), y1(t > 0.3 & t < 0.8,offset1 ==600))
title('Tidsplott av direkte ankomst')
xlabel('Tid(s), 0.3s til 0.8s')
ylabel('Amplitude')
subplot(2,1,2);
plot(t(t > 0.3 & t < 0.8), tukey_y1)
title('Tidsplott av direkte ankomst, med tukeywin')
xlabel('Tid(s), 0.3s til 0.8s')
ylabel('Amplitude')