How to remove Noise using histogram In Matlab
Show older comments
Hello Everyone, i hope you are doing well. I have the following data in which I have some noise. I want to remove the Noise using Histogram or any other Method. I have attached the picture below which is the noise.
How can i do that?

Answers (1)
Hi!
Below is a workflow based on groupcounts function:
clear
load noisydata.mat
figure
subplot(211)
plot(dataset, 'o')
title("noisy data")
% Filtering based groupcounts
[GC, GR] = groupcounts(dataset) ;
denoisedData = dataset(ismember(dataset, GR(GC>10))) ; % group that has count less than 10 will be removed
subplot(212)
plot(denoisedData, 'o')
title("denoised data")
Hope this helps
14 Comments
Stephen john
on 28 Aug 2022
Hi !
I recommend to use a slider to vary countThresh variable.
clear
load noisydata.mat
figure
subplot(211)
plot(dataset, 'o')
title("noisy data")
% Filtering based groupcounts
[GC, GR] = groupcounts(dataset) ;
countThresh = 20 ; % change this untill you see that the data is fully denoised
denoisedData = dataset(ismember(dataset, GR(GC>countThresh))) ; % group that has count less than 10 will be removed
subplot(212)
plot(denoisedData, 'o')
title("denoised data")
Stephen john
on 29 Aug 2022
Abderrahim. B
on 29 Aug 2022
@Stephen john show your code. For me working just fine.
Stephen john
on 29 Aug 2022
Abderrahim. B
on 29 Aug 2022
Please show up what print executing the below command:
class Bindata
Stephen john
on 29 Aug 2022
Abderrahim. B
on 29 Aug 2022
Edited: Abderrahim. B
on 29 Aug 2022
Sorry wanted to write
whos Bindata
Maybe you can upload the data from where you got Bindata!
Stephen john
on 29 Aug 2022
Stephen john
on 29 Aug 2022
Check the attached mlx script also.
clear
load dataset.mat
figure
subplot(211)
plot(Bindata, 'o')
title("noisy data")
ylim([20 40])
xlim([0 600])
% Filtering based groupcounts
[GC, GR] = groupcounts(Bindata) ;
countThresh = 11 ; % change this untill you see that the data is fully denoised
denoisedData = Bindata(ismember(Bindata, GR(GC>countThresh))) ; % group that has count less than 10 will be removed
subplot(212)
plot(denoisedData, 'o')
title("denoised data")
ylim([20 40])
xlim([0 600])
Stephen john
on 29 Aug 2022
Edited: Stephen john
on 29 Aug 2022
Abderrahim. B
on 29 Aug 2022
I understand, try other filtering methods. This method - based find groups count requires to set a threshold for filtering.
Stephen john
on 29 Aug 2022
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!


