Re: Signal smoothing

Doug Stewart <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <CAAohRsY+HH8afpZ31otbyytJXE4z6iaYMxi7VAyygb-s5i-EtA@mail.gmail.com>
On Wed, Dec 30, 2020 at 1:42 AM Blaz <[email protected]> wrote:

> 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/Octave-General-f1599825.html
>
>
>
Are you trying to overcome noise?

-- 
DAS[image: Certificate for 206392]

<https://linuxcounter.net/user/206392.html>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.