Re: Signal smoothing

Blaz <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <[email protected]>
Here is the proper code that a Stack Overflow Member Howard Rudd proposed
this (with my small update) if anyoune will find it useful. Kudos Howard...

function [y] = decay(t,x,tau)
  
  if nargin <3
    tau =0.064;                           
  end
  y = zeros(1, length(t));
  y(1) = x(1);
    for i = 2:length(t)
        y(i) = max(x(i), y(i-1)*exp(-(t(i)-t(i-1))/tau));
    endfor

clf
plot(t,x,'b',t, y, 'k','linewidth',2)

endfunction 



--
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.