To select indices in areal density plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!