help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Signal smoothing


From: Blaz
Subject: Re: Signal smoothing
Date: Mon, 1 Feb 2021 05:03:49 -0600 (CST)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]