Code covered by the BSD License  

Highlights from
Gaussian smoothing filter

4.5 | 4 ratings Rate this file 51 Downloads (last 30 days) File Size: 2.51 KB File ID: #43182 Version: 1.2
image thumbnail

Gaussian smoothing filter


James Conder (view profile)


23 Aug 2013 (Updated )

Function to smooth a time series using a Gaussian filter.

| Watch this File

File Information

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.

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
15 Apr 2015 Richard Fletcher  
29 Mar 2015 Sanjay Manohar  
04 Sep 2014 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.

Comment only
03 Sep 2014 jon erickson

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

06 Aug 2014 Philippe

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

05 Sep 2014 1.1

Use convolution if time vector is uniformly spaced.

24 Sep 2014 1.2

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

Contact us