Main Content

computeSpatialPoints

R2026b

Compute Cartesian coordinates of points from spherical coordinates

Since R2026b

    Description

    [points,phi,theta] = computeSpatialPoints(az,el,r) converts spherical coordinates defined by azimuth, elevation, and radius into Cartesian coordinates. The function also returns the corresponding azimuth and elevation angles in meshgrid format.

    example

    Examples

    collapse all

    Compute Cartesian coordinates for 0 to 360 degrees azimuth and 0 to 90 degrees elevation angles.

    [pt, phi, theta] = computeSpatialPoints(0:10:360,0:10:90,1)
    pt = 3×370
    
        1.0000    0.9848    0.9397    0.8660    0.7660    0.6428    0.5000    0.3420    0.1736         0    -0.1736    -0.3420    -0.5000    -0.6428    -0.7660    -0.8660    -0.9397    -0.9848    -1.0000    -0.9848    -0.9397    -0.8660    -0.7660    -0.6428    -0.5000    -0.3420    -0.1736          0     0.1736     0.3420
             0    0.1736    0.3420    0.5000    0.6428    0.7660    0.8660    0.9397    0.9848    1.0000     0.9848     0.9397     0.8660     0.7660     0.6428     0.5000     0.3420     0.1736          0    -0.1736    -0.3420    -0.5000    -0.6428    -0.7660    -0.8660    -0.9397    -0.9848    -1.0000    -0.9848    -0.9397
             0         0         0         0         0         0         0         0         0         0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0
    
    
    phi = 37×10
    
          0      0      0      0      0      0      0      0      0      0
         10     10     10     10     10     10     10     10     10     10
         20     20     20     20     20     20     20     20     20     20
         30     30     30     30     30     30     30     30     30     30
         40     40     40     40     40     40     40     40     40     40
         50     50     50     50     50     50     50     50     50     50
         60     60     60     60     60     60     60     60     60     60
         70     70     70     70     70     70     70     70     70     70
         80     80     80     80     80     80     80     80     80     80
         90     90     90     90     90     90     90     90     90     90
        100    100    100    100    100    100    100    100    100    100
        110    110    110    110    110    110    110    110    110    110
        120    120    120    120    120    120    120    120    120    120
        130    130    130    130    130    130    130    130    130    130
        140    140    140    140    140    140    140    140    140    140
          ⋮
    
    
    theta = 37×10
    
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
        0    10    20    30    40    50    60    70    80    90
          ⋮
    
    

    Input Arguments

    collapse all

    Azimuth angle, specified as a scalar or a 1-by-N vector in degrees. N is the number of azimuth angles.

    Data Types: double

    Elevation angle, specified as a scalar or a 1-by-M vector in degrees. M is the number of elevation angles.

    Data Types: double

    Radius, specified as a scalar or an M-by-N matrix in meters.

    Data Types: double

    Output Arguments

    collapse all

    Cartesian coordinates, returned as a 3-by-P matrix. P is the total number of points formed by all combinations of azimuth and elevation values (M*N).

    Data Types: double

    Azimuth angles in meshgrid format, returned as a scalar or an M-by-N matrix in degrees. M is the number of input elevation angles and N is the number of input azimuth angles. Each element represents the azimuth angle associated with a corresponding point in the spatial grid.

    Data Types: double

    Elevation angles in meshgrid format, returned as a scalar or an M-by-N matrix in degrees. M is the number of input elevation angles and N is the number of input azimuth angles. Each element represents the elevation angle associated with a corresponding point in the spatial grid.

    Data Types: double

    Version History

    Introduced in R2026b