-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter_design.m
More file actions
57 lines (52 loc) · 951 Bytes
/
filter_design.m
File metadata and controls
57 lines (52 loc) · 951 Bytes
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
clear all
close all
clc
fprintf( 'Loading... \n' );
load('raw_filter_design2.mat');
fprintf( 'Data loaded \n' );
figure(1)
for i =2:5
plot(data3(:,i),'--')
hold on
plot(data3(:,i+4))
hold on
end
fprintf( 'Loading... \n' );
load('raw_filter_design3.mat');
fprintf( 'Data loaded \n' );
figure(2)
for i =2:5
plot(data1(:,i),'--')
hold on
plot(data1(:,i+4))
hold on
end
%%
v_mat = zeros(length(data1),4);
a_mat = v_mat;
v_mat(2:end,:) = (data1(2:end,6:9)- data1(1:end-1,6:9))./(data1(2:end,1)- data1(1:end-1,1));
windowSize = 2;
b = (1/windowSize)*ones(1,windowSize);
a = 1;
for i =1:4
f_vmat(:,i)=filter(b,a,v_mat(:,i));
hold on
end
a_mat(2:end,:) = (f_vmat(2:end,:)- f_vmat(1:end-1,:))./(data1(2:end,1)- data1(1:end-1,1));
%%
figure(3)
for i =1:4
subplot(4,1,i)
plot(v_mat(:,i),'--')
hold on
plot(filter(b,a,v_mat(:,i)))
hold on
end
figure(4)
for i =1:4
subplot(4,1,i)
plot(a_mat(:,i),'--')
hold on
plot(filter(b,a,a_mat(:,i)))
hold on
end