How to smooth a vector of noisy data?
Show older comments
Very confused on how to smooth a vector of noisy data, without using MATLABS built in smooth function. Any help much appreciated
4 Comments
Image Analyst
on 5 Sep 2017
Edited: Image Analyst
on 5 Sep 2017
You could write your own routine to mimic what one of the built-in routines does. Why do you not want to use one of the built-in smoothing functions, such as smoothdata() which offers several different types of smoothing algorithms? Why re-invent the wheel?
Tom Midgley
on 5 Sep 2017
Image Analyst
on 5 Sep 2017
Edited: Image Analyst
on 5 Sep 2017
Oh, it's homework. I've added the homework tag for you. Just use a for loop.
windowWidth = 3;
halfWidth = floor(windowWidth/2);
for k = halfWidth + 1 : length(x) - halfWidth
thisWindow = x(k-halfWidth:k+halfWidth);
newValue = mean(.....
....
end
I assume you can figure out how to complete the code.
Tom Midgley
on 5 Sep 2017
Answers (0)
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!