-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_noisel.m
30 lines (25 loc) · 893 Bytes
/
get_noisel.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
% GET_NOISEL Evaluate the noise parameters from a set of signals, fitting in log-space.
%
% [TAU,THE,GAM] = get_noisel(S) computes the error model parameter
% for the signals in S, where the second dimension gives repeated
% measurements of the signal.
%
% [TAU,THE,GAM] = get_noisel(MU,SIG) take the average signal, MU,
% and standard deviation of the signals, SIG, and computes the error model
% parameters.
%
% [TAU,THE,GAM,FUN] = get_noisel(MU,SIG) updates
%
% AUTHOR: Timothy Sipkens, 2021-05-27
function [tau, the, gam, fun] = get_noisel(s, sig)
% Use covf function with 'pgm' error model.
if ~exist('sig', 'var')
[~, tau, the, gam] = covp(s, 'pgm', 2);
else
[~, tau, the, gam] = covp(s, 'pgm', sig);
end
% Quadratic curve used for fitting.
% See Sipkens et al. for why this works.
fun = @(x, s) x(1) .^ 2 .* (s .^ 2) + ...
x(2) .* s + x(3) .^ 2;
end