help-octave
[Top][All Lists]
Advanced

[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 08:13:15 +0100

On Mon, Dec 14, 2009 at 8:05 AM, Isak Delberth Davids
<address@hidden> wrote:
> Dear all,
>
> I would like to plot some 3D color-coded density plots, using
> meshgrid. I have this grid on a 2D surface (generated with meshgrid).
> Now, I am absolute stuck when it comes to counting the number of
> points falling in each grid --- I would like to use that number as
> some kind of a density per grid, which constitutes the 3rd dimension.
> Here I have a little demonstration:
>
> clear, clc, clf;
> x=rand(10,1)*10;
> y=rand(10,1)*10;
> [X Y] = meshgrid(0:1:10,0:1:10);
> Z =   .......... %must be the number of points in each square grid
> meshgrid(X,Y,Z)
>
> How should Z be defined such that it counts the number of values in
> each grid of width 1?
>
> isak.davids
>

First, you should realize that while X and Y are 11x11, there are only
10x10 squares in your grid, so Z will be 10x10.
Is this what you want?

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]