-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalc_response_stats.m
executable file
·37 lines (30 loc) · 1.16 KB
/
calc_response_stats.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
function stats = calc_response_stats(x, F, F_transition, x_peak)
% calc_response_stats.m
%
% Calculate various statistics of F.
%
% Inputs: x : x vector (vector)
% F : function value at x [vector]
% F_transition : transition value of F (float)
% x_peak : x value of some peak (float)
%
% Output: stats : statistics (struct)
%
% Original: James Pang, QIMR Berghofer, 2020
%%
if nargin<3
F_transition = 0.3;
end
for j=1:size(F,1)
stats.max(j,1) = max(F(j,:));
stats.min(j,1) = min(F(j,:));
stats.Fval_10(j,1) = stats.min(j) + 0.1*(stats.max(j)-stats.min(j));
stats.Fval_90(j,1) = stats.min(j) + 0.9*(stats.max(j)-stats.min(j));
stats.xval_10(j,1) = x(dsearchn(F(j,:)', stats.Fval_10(j)));
stats.xval_90(j,1) = x(dsearchn(F(j,:)', stats.Fval_90(j)));
stats.dynamic_range(j,1) = 10*log10(stats.xval_90(j)/stats.xval_10(j));
stats.xval_transition(j,1) = x(dsearchn(F(j,:)', F_transition));
stats.Fval_xpeak(j,1) = F(j,dsearchn(x', x_peak));
HillOutput = Hill(x,F(j,:),4,1,1,0.4,0);
stats.Hill_slope(j,1) = HillOutput{2}(2);
end