"Marko" wrote in message <k68oj4$mlg$1@newscl01ah.mathworks.com>...
> Hi!
>
> I have a digital elevation map (DEM), so this is the matrix of the terrain heights in Gauss Kruger coordinate system. The matrix size is 1015x939 and each element of the matrix presents the specific real terrain heights on the corresponding coordinates.
>
> I want to put the RF Transmitter somewhere in this 3D space and compute the RF propagation to each point of the space.
>
> For this I need to extract the elevation profiles from the transmitter point in the matrix to each of the points in space (all indices of the matrix).
>
> So the matlab problem is how to extract the matrix "grid" points (i,j) coordinates of the DEM which are closest to the lines among the transmitter and the receivers points.
>
> This is some kind of snapping lines to the closest grid points represented by the matrix (i,j) indices. Once you have these indices you can extract the DEM heights among the transmitter and the receiver from the DEM matrix...
>
> I've already tried something with the for loops and a lot of IF-ELSE clauses but, the speed of this is far from acceptable... (11 hours for the whole area)...
>
> Another problem of this is if you look the lines from the transmitter to all receiver points, those points closer to the transmitter are taken more often and multiple times to calculation (they are almost always snapped to grid), which makes the big redundancy...
>
> I need an advice how to vectorize this problem and compute/extract all elevation profiles as quick as possible, hopefully with minimum number or even without the FOR loops...
In addition, I forgot to mention this is similar as the matlab los2 function for the all points in space but not in latitude/longitude coordinates, rather in Gauss Krüger...
> Hi!
>
> I have a digital elevation map (DEM), so this is the matrix of the terrain heights in Gauss Kruger coordinate system. The matrix size is 1015x939 and each element of the matrix presents the specific real terrain heights on the corresponding coordinates.
>
> I want to put the RF Transmitter somewhere in this 3D space and compute the RF propagation to each point of the space.
>
> For this I need to extract the elevation profiles from the transmitter point in the matrix to each of the points in space (all indices of the matrix).
>
> So the matlab problem is how to extract the matrix "grid" points (i,j) coordinates of the DEM which are closest to the lines among the transmitter and the receivers points.
>
> This is some kind of snapping lines to the closest grid points represented by the matrix (i,j) indices. Once you have these indices you can extract the DEM heights among the transmitter and the receiver from the DEM matrix...
>
> I've already tried something with the for loops and a lot of IF-ELSE clauses but, the speed of this is far from acceptable... (11 hours for the whole area)...
>
> Another problem of this is if you look the lines from the transmitter to all receiver points, those points closer to the transmitter are taken more often and multiple times to calculation (they are almost always snapped to grid), which makes the big redundancy...
>
> I need an advice how to vectorize this problem and compute/extract all elevation profiles as quick as possible, hopefully with minimum number or even without the FOR loops...
In addition, I forgot to mention this is similar as the matlab los2 function for the all points in space but not in latitude/longitude coordinates, rather in Gauss Krüger...