move regression code from statistics to regression folder
This commit is contained in:
7
regression/code/boltzmann.m
Normal file
7
regression/code/boltzmann.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function y = boltzmann(parameter, x)
|
||||
% parameter 1: alpha
|
||||
% parameter 2: k
|
||||
% parameter 3: x_0
|
||||
% parameter 4: y_0
|
||||
|
||||
y = (parameter(1) ./ (1 + exp(-parameter(2) .* (x - parameter(3))))) + parameter(4);
|
||||
7
regression/code/create_linear_data.m
Normal file
7
regression/code/create_linear_data.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function y = create_linear_data(x)
|
||||
|
||||
m = 2.5;
|
||||
n = -0.35;
|
||||
d = 2.5;
|
||||
|
||||
y = x .* m + n + randn(size(x)) .* d;
|
||||
7
regression/code/estimate_regression.m
Normal file
7
regression/code/estimate_regression.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function param = estimate_regression(x,y,p_0)
|
||||
|
||||
objective_function = @(p)lsq_error(p, x, y);
|
||||
param = fminunc(objective_function, p_0);
|
||||
disp(param)
|
||||
param1 = fminsearch(objective_function, p_0);
|
||||
disp(param1)
|
||||
5
regression/code/exponential.m
Normal file
5
regression/code/exponential.m
Normal file
@@ -0,0 +1,5 @@
|
||||
function y = exponential(parameter, x)
|
||||
% Function implements an exponential function with two parameters
|
||||
% controlling the amplitude and the time constant.
|
||||
|
||||
y = parameter(1) .* exp(x./parameter(2));
|
||||
Reference in New Issue
Block a user