[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: counting totals in square grids (meshgrid)
From: |
Jaroslav Hajek |
Subject: |
Re: counting totals in square grids (meshgrid) |
Date: |
Mon, 14 Dec 2009 09:36:44 +0100 |
On Mon, Dec 14, 2009 at 8:41 AM, Isak Delberth Davids
<address@hidden> wrote:
> I would like to use the boundaries of the x-y grids, such that for
> example all numbers in the interval:
>
> x=0 and x<1 & y=0 and y<1 are counted as the total count of say grid-1.1
> x=1 and x<2 & y=0 and y<1 are counted as the total count of say grid-2.1
> x=2 and x<3 & y=0 and y<1 are counted as the total count of say grid-3.1
> .
> .
> .
> x=n and x<n+1 & y=0 and y<1 are counted as the total count of say grid-n.1
> .
> .
> .
> x=0 and x<1 & y=1 and y<2 are counted as the total count of say grid-1.2
> x=0 and x<1 & y=2 and y<3 are counted as the total count of say grid-1.3
> x=0 and x<1 & y=3 and y<4 are counted as the total count of say grid-1.4
> .
> .
> .
> x=0 and x<1 & y=n and y<n+1 are counted as the total count of say grid-1.n
> .
> .
> .
> and so on. I hope that makes it a bit clearer ...
>
>
> isak.davids
Huh? x=0 and x<1 is a tautology (the first implies the second) ...?
If I understand correctly, you have two vectors, x and y, of length m,
and you want to compute an nxn matrix grid so that
grid(i,j) is the count of indices k=1..m such that i-1 <= x(k) < i &&
j-1 <= y(k) < j
In octavish,
grid(i,j) = sum (i-1 <= x & x < i & j-1 <= y & y < j).
for all i,j=1:n.
Is this correct?
--
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
- counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid),
Jaroslav Hajek <=
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14
- Re: counting totals in square grids (meshgrid), Jaroslav Hajek, 2009/12/14
- Re: counting totals in square grids (meshgrid), Isak Delberth Davids, 2009/12/14