
From:  Doug Stewart 
Subject:  Re: Signal smoothing 
Date:  Wed, 30 Dec 2020 05:55:20 0500 
Hello again
This time I have a problem of signal smoothing. I have an input signal (x)
which I import from a .cvs file. It is in principle the combination of sine
wave with added exponential decay. However I would like to smooth the signal
with an exponential function (T is a time constant which is a setting) fro
mlocal tops. These tops are not always the same so simply max (x) does not
work. This is my attempt below, but it does not work properly. Any advise
appreciated.
function [xs] = smooth (t,x,T)
if nargin <3
T =0.064; % konstanta za glajenje Stab toka (Siemens
7SS52 Manual, str 94)
end
temp=0;
f=1;
AX=max(x);
m=length(x);
xs=zeros(m,1);
lookback=10;
for i = 1 : m
u(i) = exp((t(i))/T);
end
xs(1:lookback) = x(1:lookback);
for j = lookback : m
if AX*u(f) < x(j)
xs(j) = x(j);
f=1;
end
if AX*u(f) > x(j)
xs(j) = AX*u(f);
f++;
end
end
plot(t,x,t,xs)
endfunction
ex.png <https://octave.1599824.n4.nabble.com/file/t373917/ex.png>

Sent from: https://octave.1599824.n4.nabble.com/OctaveGeneralf1599825.html
[Prev in Thread]  Current Thread  [Next in Thread] 