-
Notifications
You must be signed in to change notification settings - Fork 65
/
plotfilter.m
69 lines (60 loc) · 1.08 KB
/
plotfilter.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
%
% PLOTFILTER
%
% Get and plot source time dependence function g(t).
%
% [t,ef,nf,uf]=plotfilter( fname, fc, style, doplot, hld )
%
% Input:
% Output:
function [t,ef,nf,uf]=plotfilter( fname, fc, style, doplot, hld )
if nargin < 5
hld = 0;
end
if nargin < 4
doplot = 1;
end
if nargin < 3
style = 'k-';
end;
[t e n u]=readusgs(fname);
dt = t(2)-t(1);
if fc > 0
[b a]=mybutter2(2*dt*fc);
ef = myfiltfilt(b,a,e);
nf = myfiltfilt(b,a,n);
uf = myfiltfilt(b,a,u);
else
ef = e;
nf = n;
uf = u;
end
if doplot == 1
subplot(3,1,1);
if hld==1
hold on;
else
hold off;
end;
plot(t,ef,style);
rng = max(ef)-min(ef);
axis([t(1) t(end) min(ef)-0.2*rng max(ef)+0.2*rng]);
subplot(3,1,2);
if hld==1
hold on;
else
hold off;
end;
plot(t,nf,style);
rng = max(nf)-min(nf);
axis([t(1) t(end) min(nf)-0.2*rng max(nf)+0.2*rng]);
subplot(3,1,3);
if hld==1
hold on;
else
hold off;
end;
plot(t,uf,style);
rng = max(uf)-min(uf);
axis([t(1) t(end) min(uf)-0.2*rng max(uf)+0.2*rng]);
end;