how to smooth the data of array to get a smooth surface?
5 views (last 30 days)
Show older comments
Abdullah on 8 Mar 2023
Commented: William Rose on 9 Mar 2023
how i can remove outliers in data and get a smooth surface?
Check this out:
Or do a median filter, in which each point is replaced by the median of a pxp array centered on that point.
@Abdullah, an example of a median filter for a surface:
First, make a surface with some "noise":
mesh(-20:20,-15:15,A) %display the surface
Filter it with a pxp median filter
p=5; p2=floor(p/2); [n,m]=size(A);
B=zeros(n,m); %allocate array for smoothed surface
mesh(-20:20,-15:15,B) %display the surface
The edges are zeros in my simple code, because, if the filter gets any closer to the edges, it will extend beyond the bounds of the original array, which would cause an error. You could improve this by adapting the filter as needed, when it gets near the edge.
Find more on Smoothing and Denoising 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!