What sort of a filter/method can be applied to smoothen sharp peaks on a surface?

조회 수: 15 (최근 30일)
Jithin S
Jithin S 2019년 8월 2일
답변: Abdullah 2023년 3월 8일
This is a surface I simulated via coding. The surf plot shows sharp peaks.
ABAQUS_Surface texture_10,20,50.jpg
I have the data as a matrix Z(101,101).
However, ideally the surface should look smooth as shown in figure below. What sort of a filter can I apply?
The sharp peaks needs to be smoothen so that it can resemble the surface given below.
Measured_Surface texture_10,20,50.jpg

답변 (2개)

David K.
David K. 2019년 8월 2일
In general, if you want to smooth out peaks you want to get rid of the high frequency content, aka a low pass filter. The easiest lpf is a moving average filter. I think this should work for your implementation.
window = 9; % Increase to smooth more, decrease to smooth less
H = ones(window)./(window^2); % Create the window and divide so that it is an average and not just a sum
filteredZ = filter2(H,Z);
surf(filteredZ)
Check out the filter2 documentation to get a better idea on what it is doing. Hope this helps
  댓글 수: 1
Katherine Zheng
Katherine Zheng 2022년 11월 1일
Hi @David K., Thanks for you method. But your code has weird padding at edge of the surface. How can I eliminate this effect?

댓글을 달려면 로그인하십시오.


Abdullah
Abdullah 2023년 3월 8일
did you find a way to do this?

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by