To select indices in areal density plot

1 visualizzazione (ultimi 30 giorni)
Bhowmik.U
Bhowmik.U il 20 Gen 2017
I have X and Y column matrices, I need to plot occurrence density of X-Y pair in 5*5 bin in an area of 250*250, so a total 50 boxes in X and 50 in Y...2500 boxes in 2D, I did it through a code I paste here my code.
But, I wish to know indices of each X-Y pair in all the boxes separately?
My code runs
[X, txt1, raw1] = xlsread('A.xls',1,'M:M');
[Y, txt1, raw1] = xlsread('A.xls',1,'N:N');
binmin = -125; binmax = 125; binwidth = 5;
xbin = 1 + floor((X(:) - binmin) / binwidth); ybin = 1 + floor((Y(:) - binmin) / binwidth); nbins = ceil((binmax - binmin) / binwidth); counts = accumarray([xbin, ybin], 1, [nbins, nbins]); counts=(counts./max(max(counts))); figure(1)
imageSizeX = 50; imageSizeY = 50; figure(1) [columnsInImage rowsInImage] = meshgrid(1:imageSizeX, 1:imageSizeY); % Next create the circle in the image. centerX = 25; centerY = 25; radius = 25; % centerX =50; % centerY = 50; % radius = 50; circlePixels = (rowsInImage - centerY).^2 ... + (columnsInImage - centerX).^2 <= radius.^2; final = double(circlePixels) contourf(final);

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by