File Exchange

image thumbnail

Gaussian smoothing filter

version 1.2 (2.51 KB) by

Function to smooth a time series using a Gaussian filter.



View License

A non-GUI function that will smooth a time series using a simple Gaussian filter.
zfilt = gaussfilt(t,z,sigma);
where t & z define the time series (t independent variable and z is data vector), and sigma defines the standard deviation (width) of the Gaussian filter.

Comments and Ratings (10)

Thien Tran

aram salehi


LomiJA (view profile)


James Conder

James Conder (view profile)

Aray, could you expound on the low ranking? Maybe I can do something to improve it.

aray makan


Noise (view profile)

James Conder

James Conder (view profile)

jon, thanks for the feedback. I originally wrote the function for a non-uniformly spaced time vector, which conv would not handle correctly. That said, I expect most uses of this function will be for uniformly spaced time vectors, where your criticism is exactly right.

I uploaded an update that will look to do the convolution unless the spacing is variable, in which case it will use the (ugly) loop.

jon erickson

jon erickson (view profile)

Works fine, but implementation is could be improved/sped up by using conv(...) instead of a for loop to compute filtered waveform


Great! Does what it advertise. Thanks for this submission.



Removed extraneous keyboard command that was accidentally left in on previous update.


Use convolution if time vector is uniformly spaced.

MATLAB Release
MATLAB 8.0 (R2012b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video