Easiest way to make a sequence is to generate some integers and multiply them, as in:

  $Nbearings = $bN - $b0 + 1;
  $bearstep = $db * pi/180;
  $bears = (xvals($Nbearings) + $b0) * $bearstep;

xvals, yvals, zvals, and axisvals all create N-dimensional PDLs containing the index along a given dimension.

Related functions:
-rvals(), which does the same thing for radius from the center (or a given location) -ndcoords(), which creates an Nx(1..N) PDL with an Nindex vector for each of N dimensions
                (as in "$vecs = ndcoords(5,5)").




        
On Jul 7, 2011, at 1:23 AM, dpath2o wrote:

Hi PDL-List,

I have hopefully a quick query (easily answered) ...

In matlab if you want to create a sequence from -255 to 255 by 0.1 you'd code in ``x = -255:0.1:255;''

I have read through the following PDL functions (sequence , xlinvals , etc. ) and while I can manage to do a sequencing from I can't seem to figure out the syntax to do what I want. Here is the bit of code that I have:

use strict;
use bignum;
use Math::Trig qw(:pi :radial :great_circle);
use PDL;

my $bw = 50000; #band width in Hz
my $b0 = 180; #start bearing in deg.TrueN
my $bN = 349; #stop bearing in deg.TrueN
my $db = 5; #delta bearing in degrees
my $dr = 3.15; #delta range in kilometres
my $rN = 220; #stop range in kilometres
my $ln = 116; #longitude
my $lt = -32; #latitude

# convert geographic bearings in degrees to cartesian angles in radians
$b0 = ( (90-$b0)%360 )*pi / 180;
$bN = ( (90-$bN)%360 )*pi / 180;
$db = $db*pi / 180;

# piddle-fy bearings
my @bears = map { $db x $_ } $b0..$bN;
my $bs = pdl @bears;
my @d = $bs->dims;
print "@d\n";

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to