Can you use islocalmax2 for a nxnxn grid where the values of that grid correspond to peaks in data density?
조회 수: 3 (최근 30일)
이전 댓글 표시
I am trying to pickout peaks of data density. I fit my data to a kernel density estimation using the mvksdensity function.
I then get a matrix, Z, the size of my grid where the values correspond to the density of the data in the 3D variable space.
My question is, can I use islocalmax2 to pick out peaks in this nxnxn matrix Z, or does it only work in 2 dimensional arrays.
The documentation lists the input data can be a multidimensional array, though I'm not sure if it works with a page size greater than 1.
My goal is to calculate the prominence of of these peaks as well so if anyone has any resources related to that in more than 2 dimensions, that would be very helpful.
I've also used the imregional max function from the image processing toolbox, but the user doesn't have control over any parameters for the peaks.
댓글 수: 0
답변 (1개)
Milan Bansal
2024년 5월 2일
편집: Milan Bansal
2024년 5월 2일
Hi Poison Idea fan,
The function islocalmax2 is compatible with multidimensional arrays, that means you can use it to get the peaks in the n x n x n matrix "Z" as well. The function will return the output as a 3 dimensional "logical" array with same size as that of "Z". The function will find local maximas for each 2-D layer (n x n) in "Z".
A = rand(100, 100, 100); % create a random 3D matrix of size 100 x 100 x 100
TF = islocalmax2(A);
size(TF)
You can also calculate the "prominence" using the same function as shown below.
[TF, P] = islocalmax2(A); % P is the prominence
Please refer to the following documentation link to learn more about islocalmax2 function.
Hope this helps!
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!