This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/regression/exercises/expdecaygradient.m

12 lines
431 B
Matlab

function gradient = expdecaygradient(t, x, tau)
% Gradient of MSE for a decaying exponential.
%
% Arguments: t, vector of time points.
% x, vector of the corresponding measured data values.
% tau, value for the time constant.
%
% Returns: gradient: the derivative of the MSE with respect to tau.
h = 1e-7; % stepsize for derivative
gradient = (expdecaymse(t, x, tau+h) - expdecaymse(t, x, tau))/h;
end