Hi,,
does any body can guide me how to developed a Cartesian coordinate type relation ships between kgrid points.
let
Nx = 100;
Ny = 100;
dx = 1;
dy = 1;
kgrid = makeGrid(Nx, dx, Ny, dy);
I know that the distance of each kgrid point can be calculated by using the formula
sqrt(kgrid.x.^2 + kgrid.y.^2);
how can the (0,0) of the kgrid be points be related to cartesian cordiantes. i wants a general relationship ..
any help will be higly appreciated.
k-Wave
A MATLAB toolbox for the time-domain
simulation of acoustic wave fields
Cartesian Co-Ordinate and Kgrid Points
(4 posts) (2 voices)-
Posted 10 years ago #
-
Hi Zia,
I'm not sure I completely follow what you're asking? k-Wave indexes the grid points from the centre, where the grid index of the centre point is given by
floor(Nx/2) + 1
, i.e.,for
Nx = 4
:
-2 -1 0 1
for
Nx = 5
:
-2 -1 0 1 2
To convert these to cartesian points, these are just multiplied by the grid point spacing (e.g.,
kgrid.dx
).Hope that helps,
Brad.
Posted 10 years ago # -
Hi Bradley Treeby,
Thank you so much for looking into the problem. Your help is always to the point.please look into the following,Nx=100;
Ny=100;
dx=1;
dy=1;
kgrid= makeGrid(Nx, dx, Ny, dy);for above are the following correct.orign (0,0) is at Nx=Ny=51;
the coordinate of the first quardent Nx=1 upto 51, and Ny=51 upto 100;
the coordinate of the second quardent Nx=1 upto 51, and Ny=1 upto 51;
the coordinate of the third quardent Nx=51 upto 100, and Ny=1 upto 51;
the coordinate of the forth quardent Nx=51 upto 100,and Ny=51 upto 100;
'
what actually i want to do is that i have an arry of 3-sensors along the x-axis or Y-axis.
Let the middle sensor to be at the orign. now i want toplace the source at some distance say R,
R is making some angle theta with middle sensor. How i can proceed...?regards.
Posted 10 years ago # -
Hi Zia,
You can calculate this using some simple trigonometry. If the sensor is positioned with grid coordinates
[x, y]
, the position of the source (in grid points) will beround([x + R*cos(theta), y + R*sin(theta)])
(or similar, depending on how you define your angles).Brad.
Posted 10 years ago #
Reply
You must log in to post.