noise removal without a built in function
10 views (last 30 days)
Farouk Moukaddem on 14 Dec 2016
Edited: Farouk Moukaddem on 14 Dec 2016
There are several ways to remove noise from the 2-D data:
1) You can use the "medfilt2" function from the Image Processing Toolbox, which does 2-D median filtering.
>> B=medfilt2(A, [m n], padopt)
The command above performs median filtering of the matrix A in two dimensions. Each output element of the matrix B contains the median value in the m-by-n neighborhood around the corresponding element in the input matrix A.
For more information about the "medfilt2" function, refer to the documentation by executing the following at the MATLAB Command Line:
2) You can also use the "filter2" Matlab Function
This command filters the data in X with the two-dimensional FIR filter in the matrix h. It computes the result, Y, using two-dimensional correlation, and returns the part of the correlation specified by the 'shape' parameter.
Refer to the documentation for more information by executing:
Also refer to the following code that illustrates the above concepts:
% Set figure window size
dfpos = get(0,'DefaultFigurePosition');
figure('Position',dfpos([1 2 3 4]).*[1 1 1.5 1]);
% Smooth the noisy peaks data with MEDFILT2
ZN_smooth1=medfilt2(ZN, [15 15],'symmetric');
title('Peaks Surface (2-D median filter applied)')
% Smooth the noisy peaks data with FILTER2
h = fspecial('average', [10 10]);
title('Peaks Surface(2-D digital averaging filter applied)')