-
Notifications
You must be signed in to change notification settings - Fork 4
/
SplitIntFunction.m
85 lines (55 loc) · 1.31 KB
/
SplitIntFunction.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
function [ m1low, m1est, m1high] = SplitIntFunction( T,Q ,samprate)
%Calculates splitting intesity based on Chevrot, 2000
% Uses the window chosen for Q and T
% Simply the maximum amplitude of the transverse divided by the maximum
% amplitude of the time derivative of the radial
%% Written by Neala Creasy
% 1/sampling rate
xx=samprate;
% finds time derivative of the Radial component
for put = 1:length(T)-1
rd(put)= (Q(put+1)-Q(put))/xx;
end
% Equation from Chevrot, 2000
T(end) = [];
Pop= dot(T,rd);
NPop =norm(rd)^2;
%Splitting Intensity
SplitIntensity=-2*Pop/NPop;
m1est=SplitIntensity;
S_expec = -0.5*SplitIntensity.*rd;
%figure
%plot(rd)
%hold on
%plot(T,'r')
%N=length(rd);
%root mean squared error
rdelta = 0;
for p=1:length(T)
rdelta = rdelta+(T(p)+0.5*SplitIntensity*rd(p))^2;
end
ndf = getndf1(T,length(T),length(T));
variance=(1/(ndf-1))*rdelta;
%f=finv(0.95,1,ndf-1);
tin=tinv(0.95,ndf-1);
ssee=0;
for t=1:length(rd)
ssee=ssee+(rd(t)-mean(rd))^2;
end
sm2=variance/ssee;
m1high=SplitIntensity+tin*sqrt(sm2);
m1low=SplitIntensity-tin*sqrt(sm2);
% another techniqu in finding the splitting intensity
% aup = 0;
% alow = 0;
%
%
% for pu = 1:length(T)-1
%
% aup = aup + T(pu)*rd(pu);
% alow = alow + rd(pu)*rd(pu);
%
% end
%
% SplitIntensity=-2*aup/alow;
end