Finding average of matrix elements within a specified window

조회 수: 6 (최근 30일)
Marcus Rosales
Marcus Rosales 2021년 3월 25일
답변: Swetha Polemoni 2021년 3월 29일
So I am trying to clean some plots up and I think I can do so if I had a function which took in some matrix A and returned a new matrix B which is the average of the elements of A within a window of size 2nx2m (looks at n neighbors to right and left as well as m on top and bottom).
M = movmean(A,k) seems to be close to what I want, but the window seems to be restricted to a row and I really want all neighbors within a specified window. I can code this myself, but it might be kindof tediuos worrying about the edge of a matrix. Is there a Matlab function which can do this for me?

답변 (1개)

Swetha Polemoni
Swetha Polemoni 2021년 3월 29일
Hi
You might find this file exchange, Moving Average Filter (2D) useful.

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by