move regression code from statistics to regression folder

This commit is contained in:
2015-10-27 09:39:02 +01:00
parent e74993c2cf
commit cc2515f22b
7 changed files with 0 additions and 61 deletions

View 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);

View 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;

View 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)

View 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));