Suggest a filter to remove the noise from the signal

Can someone suggest a filter to remove the noise from the signal shown in this image (with the sampling rate being 500)?

2 Comments

As usual I do not see anything on tinypic.
Jan
Jan on 18 Sep 2013
Edited: Jan on 18 Sep 2013
On imageshack I see a large banner in the foreground, which wants me to click on a "Enter to win" button, as far as I understand. The small [x] on the top right does not close the banner. I hate such stuff.
@GovaReDDy: It is not your fault. TMW hsitates for years to allow storing pictures on their server. But this is the only location where pictures concerning the forum should be hosted.

Sign in to comment.

 Accepted Answer

I'd try a modified median filter
% Take median filter.
medianFilteredSignal = medfilt2(signal, [1,3]);
% Find where signal is bad
badElements = signal < 400 | signal > 900;
% Replace bad elements with median filtered values.
noiseFreeSignal = signal; % Initialize.
noiseFreeSignal(badElements) = medianFilteredSignal(badElements); % Do the replacement

10 Comments

@ Image Analyst:
I am getting error like Undefined function 'medfilt2' for input arguments of type 'double' as I only have this tools on my Matlab
MATLAB Version 8.0 (R2012b)
Optimization Toolbox Version 6.2.1 (R2012b)
Signal Processing Toolbox Version 6.18 (R2012b)
I looked here
But was confused of designing a medfilt2 for this purpose only.Need your help with the medfilt2 design.
Then replace the median filter with a box filter (sliding mean):
% Take average filter.
averagedSignal = conv(signal, [1,1,1]/3, 'same');
% Find where signal is bad
badElements = signal < 400 | signal > 900;
% Replace bad elements with mean filtered values.
noiseFreeSignal = signal; % Initialize.
noiseFreeSignal(badElements) = averagedSignal(badElements); % Do the replacement
I followed as you mentioned above like this
where x is my signal.
% Take average filter.
averagedSignal = conv(x, [1,1,1]/3, 'same');
% Find where signal is bad
badElements = x < 505 |x >862;
% Replace bad elements with mean filtered values.
noiseFreeSignal = x; % Initialize.
noiseFreeSignal(badElements) = averagedSignal(badElements); % Do the replacement
subplot(2,1,1),plot(x);ylabel('amplitude(ma)');xlabel('time(ms)');title('noise signal');
subplot(2,1,2),plot(noiseFreeSignal);ylabel('amplitude(ma)');xlabel('time(ms)');title('Filtered signal');
And the output obtained is
The noise is not filtered .Is there anything more I need for the filtering.
Thanks.
@Image Analyst:Did I made any mistake.Can you have a look at this.
Thanks in Advance.
Please attach your signal so I can try the code on your specific signal.
Thanks but It's showing error
??? Error using ==> conv Too many input arguments.
Error in ==> D_signal_Filtering at 20 averagedSignal = conv(signal, ones(1,windowWidth)/windowWidth, 'same');
I am using R2008b and its taking two inputs.Any solution with the third option 'same'.
I'd recommend you upgrade. If you can't then just leave out the 'same' option to get the full convolution, which will of course be a longer array if you know about how convolutions work. But you can crop off the edges if you want manually after the convolution is done.
problem has occured can give the details about noise separation from signal
I don't understand the above comment or question by Manjuri.

Sign in to comment.

More Answers (1)

It is impossible to suggest a filter based on the information of the sample frequency only. We cannot know the nature of the noise and of the wanted signal. You could be interested in low or high frequencies or in a specific band. But the filter parameters must depend on these details. So please provide more information.

2 Comments

So, as shown in the link the signal is containing noise which is labeled with red colour.Any suggestion to remove this kind of noise. Thanks in Advance.
It matters if you have some peaks only, or if a frequency spectrum of the noise is know, if you know the frequency spectrum of the wanted signal and can suppress anything outside it.

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!