Proper way to add noise to signal

I’m adding another answer since it strikes me that Steven’s is not quite correct and Horchler’s suggestion to look inside function awgn is a good one. Either MATLAB or Octave (in the communications toolbox) have a function awgn that adds (white Gaussian) noise to attain a desired signal-to-noise power level; the following is the relevant … Read more

Sweep / chirp signal ends at incorrect frequency

The following code explains how to generate a frequency-variable sin wave. freq1=20; %start freq freq2=200; %end freq dur=1; %duration of signal in seconds freq=@(t)freq1+(freq2-freq1)/dur*t; %another example, may help to understand the code %dur=2 %freq=@(t)heaviside(t-1)*10+heaviside(t-1.5)*-9; %Integerate over the time-local frequency, gives the average frequency until t which later on gives the sin with the right phase … Read more

calculate exponential moving average in python

EDIT: It seems that mov_average_expw() function from scikits.timeseries.lib.moving_funcs submodule from SciKits (add-on toolkits that complement SciPy) better suits the wording of your question. To calculate an exponential smoothing of your data with a smoothing factor alpha (it is (1 – alpha) in Wikipedia’s terms): >>> alpha = 0.5 >>> assert 0 < alpha <= 1.0 … Read more