git-svn-id: http://moon:8086/svn/matlab/trunk@153 801c6759-fa7c-4059-a304-17956f83a07c
43 lines
1.0 KiB
Matlab
Executable File
43 lines
1.0 KiB
Matlab
Executable File
% Magnitude Estimation von x
|
|
% Schätzung des mittleren Betrages von x
|
|
% mit getrennter Anstiegs- und Abfallzeit tr, tf
|
|
% ----------------------------------------------
|
|
%
|
|
% Aufruf:
|
|
% function [mx,mxf] = mx2(x,tr,tf,mxi)
|
|
%
|
|
% Parameter:
|
|
% x : Eingangsvektor
|
|
% tr : Zeitkonstante Anstiegszeit
|
|
% tf : Zeitkonstante Abfallzeit
|
|
% mxi : Initial Condition Anfangsbetrag von x
|
|
%
|
|
% Rückgabewerte:
|
|
% mx : Ausgang mittlerer Betrag von x
|
|
% mxf : Endbetrag von x
|
|
|
|
% -------------------------------------------------------------------------
|
|
% Datum : 27.03.2002
|
|
% Autor : Jens Ahrensfeld
|
|
% Thema : Diplomarbeit
|
|
% Datei : mx2.m
|
|
%
|
|
% -------------------------------------------------------------------------
|
|
function [mx,mxf] = mx2(x,tr,tf,mxi)
|
|
|
|
N = lge(x);
|
|
x = abs(x);
|
|
mx(1) = mxi;
|
|
|
|
for n = 2:N,
|
|
if(x(n) > mx(n-1))
|
|
mx(n) = tr*x(n) + (1-tr)*mx(n-1);
|
|
else
|
|
mx(n) = tf*x(n) + (1-tf)*mx(n-1);
|
|
end;
|
|
end;
|
|
mxf = mx(N);
|
|
|
|
% -------------------------------------------------------------------------
|
|
% Ende mx2.m
|