Signal smoothing

Blaz <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <[email protected]>
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
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.