Main Content

fieldOfView

Visualize field of view of conical sensor

Since R2021a

    Description

    fieldOfView(sensor) adds a FieldOfView object to the specified conical sensor, and draws contours on the Earth. Each contour represents the field of view of a conical sensor in sensor based on the current state of the scenario.

    Locations inside the contour are inside the field of view. The field of view contours are drawn on all open satellite scenario viewers. The contours are the lines of intersection of the surface of the earth and the field of view cone. The half angle of the field of view cone equals the MaxViewAngle property of the conical sensor, and the axis of the cone is the z-axis (or boresight) of the conical sensor. The vertex of the cone is located at the position of the conical sensor. The cone becomes wider along the positive body z-axis of the conical sensor.

    example

    fieldOfView(sensor,Name,Value) specifies options by using one or more name-value arguments.

    fov = fieldOfView(___) returns a vector of handles to the added field of view graphic objects. Specify any input combination from previous syntaxes.

    Examples

    collapse all

    Create a satellite scenario with a start time of 15-June-2021 8:55:00 AM UTC and a stop time of five days later. Set the simulation sample time to 60 seconds.

    startTime = datetime(2021,6,21,8,55,0);
    stopTime = startTime + days(5);
    sampleTime = 60;                                      % seconds
    sc = satelliteScenario(startTime,stopTime,sampleTime)
    sc = 
      satelliteScenario with properties:
    
             StartTime: 21-Jun-2021 08:55:00
              StopTime: 26-Jun-2021 08:55:00
            SampleTime: 60
          AutoSimulate: 1
            Satellites: [1×0 matlabshared.satellitescenario.Satellite]
        GroundStations: [1×0 matlabshared.satellitescenario.GroundStation]
             Platforms: [1×0 matlabshared.satellitescenario.Platform]
               Viewers: [0×0 matlabshared.satellitescenario.Viewer]
              AutoShow: 1
    
    

    Add a satellite to the scenario using Keplerian orbital elements.

    semiMajorAxis = 7878137;                                                                    % meters
    eccentricity = 0;
    inclination = 50;                                                                           % degrees
    rightAscensionOfAscendingNode = 0;                                                          % degrees
    argumentOfPeriapsis = 0;                                                                    % degrees
    trueAnomaly = 50;                                                                           % degrees
    sat = satellite(sc,semiMajorAxis,eccentricity,inclination,rightAscensionOfAscendingNode, ...
        argumentOfPeriapsis,trueAnomaly)
    sat = 
      Satellite with properties:
    
                      Name:  Satellite 1
                        ID:  1
            ConicalSensors:  [1x0 matlabshared.satellitescenario.ConicalSensor]
                   Gimbals:  [1x0 matlabshared.satellitescenario.Gimbal]
              Transmitters:  [1x0 satcom.satellitescenario.Transmitter]
                 Receivers:  [1x0 satcom.satellitescenario.Receiver]
                  Accesses:  [1x0 matlabshared.satellitescenario.Access]
                   Eclipse:  [1x0 Aero.satellitescenario.Eclipse]
               GroundTrack:  [1x1 matlabshared.satellitescenario.GroundTrack]
                     Orbit:  [1x1 matlabshared.satellitescenario.Orbit]
            CoordinateAxes:  [1x1 matlabshared.satellitescenario.CoordinateAxes]
           OrbitPropagator:  sgp4
               MarkerColor:  [0.059 1 1]
                MarkerSize:  6
                 ShowLabel:  true
            LabelFontColor:  [1 1 1]
             LabelFontSize:  15
             Visual3DModel:  
        Visual3DModelScale:  1
    
    

    Add a ground station, which represents the location to be photographed, to the scenario.

    gs = groundStation(sc,Name="Location to Photograph", ...
        Latitude=42.3001,Longitude=-71.3504)                 % degrees
    gs = 
      GroundStation with properties:
    
                     Name:  Location to Photograph
                       ID:  2
                 Latitude:  42.3001 degrees
                Longitude:  -71.3504 degrees
                 Altitude:  0 meters
        MinElevationAngle:  0 degrees
           ConicalSensors:  [1x0 matlabshared.satellitescenario.ConicalSensor]
                  Gimbals:  [1x0 matlabshared.satellitescenario.Gimbal]
             Transmitters:  [1x0 satcom.satellitescenario.Transmitter]
                Receivers:  [1x0 satcom.satellitescenario.Receiver]
                 Accesses:  [1x0 matlabshared.satellitescenario.Access]
                  Eclipse:  [1x0 Aero.satellitescenario.Eclipse]
           CoordinateAxes:  [1x1 matlabshared.satellitescenario.CoordinateAxes]
              MarkerColor:  [1 0.4118 0.1608]
               MarkerSize:  6
                ShowLabel:  true
           LabelFontColor:  [1 1 1]
            LabelFontSize:  15
    
    

    Add a gimbal to the satellite. You can steer this gimbal independently of the satellite.

    g = gimbal(sat)
    g = 
      Gimbal with properties:
    
                    Name:  Gimbal 3
                      ID:  3
        MountingLocation:  [0; 0; 0] meters
          MountingAngles:  [0; 0; 0] degrees
          ConicalSensors:  [1x0 matlabshared.satellitescenario.ConicalSensor]
            Transmitters:  [1x0 satcom.satellitescenario.Transmitter]
               Receivers:  [1x0 satcom.satellitescenario.Receiver]
          CoordinateAxes:  [1x1 matlabshared.satellitescenario.CoordinateAxes]
    
    

    Track the location to be photographed using the gimbal.

    pointAt(g,gs);

    Add a conical sensor to the gimbal. This sensor represents the camera. Set the field of view to 60 degrees.

    camSensor = conicalSensor(g,MaxViewAngle=60)
    camSensor = 
      ConicalSensor with properties:
    
                    Name:  Conical sensor 4
                      ID:  4
        MountingLocation:  [0; 0; 0] meters
          MountingAngles:  [0; 0; 0] degrees
            MaxViewAngle:  60 degrees
                Accesses:  [1x0 matlabshared.satellitescenario.Access]
             FieldOfView:  [0x0 matlabshared.satellitescenario.FieldOfView]
          CoordinateAxes:  [1x1 matlabshared.satellitescenario.CoordinateAxes]
    
    

    Add access analysis to the conical sensor between the camera and the location to be photographed.

    ac = access(camSensor,gs)
    ac = 
      Access with properties:
    
        Sequence:  [4 2]
        LineWidth:  3
        LineColor:  [0.3922 0.8314 0.0745]
    
    

    Visualize the field of view of the camera by using the Satellite Scenario Viewer.

    v = satelliteScenarioViewer(sc);
    fieldOfView(camSensor);

    Determine the intervals during which the camera can see the geographical site.

    t = accessIntervals(ac)
    t=35×8 table
              Source                   Target             IntervalNumber         StartTime                EndTime           Duration    StartOrbit    EndOrbit
        __________________    ________________________    ______________    ____________________    ____________________    ________    __________    ________
    
        "Conical sensor 4"    "Location to Photograph"           1          21-Jun-2021 10:38:00    21-Jun-2021 10:55:00      1020           1            2   
        "Conical sensor 4"    "Location to Photograph"           2          21-Jun-2021 12:36:00    21-Jun-2021 12:58:00      1320           2            3   
        "Conical sensor 4"    "Location to Photograph"           3          21-Jun-2021 14:37:00    21-Jun-2021 15:01:00      1440           3            4   
        "Conical sensor 4"    "Location to Photograph"           4          21-Jun-2021 16:41:00    21-Jun-2021 17:04:00      1380           5            5   
        "Conical sensor 4"    "Location to Photograph"           5          21-Jun-2021 18:44:00    21-Jun-2021 19:07:00      1380           6            6   
        "Conical sensor 4"    "Location to Photograph"           6          21-Jun-2021 20:46:00    21-Jun-2021 21:08:00      1320           7            7   
        "Conical sensor 4"    "Location to Photograph"           7          21-Jun-2021 22:50:00    21-Jun-2021 23:04:00       840           8            8   
        "Conical sensor 4"    "Location to Photograph"           8          22-Jun-2021 09:51:00    22-Jun-2021 10:02:00       660          13           13   
        "Conical sensor 4"    "Location to Photograph"           9          22-Jun-2021 11:46:00    22-Jun-2021 12:07:00      1260          14           15   
        "Conical sensor 4"    "Location to Photograph"          10          22-Jun-2021 13:46:00    22-Jun-2021 14:10:00      1440          15           16   
        "Conical sensor 4"    "Location to Photograph"          11          22-Jun-2021 15:49:00    22-Jun-2021 16:13:00      1440          16           17   
        "Conical sensor 4"    "Location to Photograph"          12          22-Jun-2021 17:53:00    22-Jun-2021 18:16:00      1380          18           18   
        "Conical sensor 4"    "Location to Photograph"          13          22-Jun-2021 19:55:00    22-Jun-2021 20:18:00      1380          19           19   
        "Conical sensor 4"    "Location to Photograph"          14          22-Jun-2021 21:58:00    22-Jun-2021 22:16:00      1080          20           20   
        "Conical sensor 4"    "Location to Photograph"          15          23-Jun-2021 10:56:00    23-Jun-2021 11:16:00      1200          26           27   
        "Conical sensor 4"    "Location to Photograph"          16          23-Jun-2021 12:56:00    23-Jun-2021 13:19:00      1380          27           28   
          ⋮
    
    

    Calculate the maximum revisit time in hours.

    startTimes = t.StartTime;
    endTimes = t.EndTime;
    revisitTimes = hours(startTimes(2:end) - endTimes(1:end-1));
    maxRevisitTime = max(revisitTimes)                             % hours
    maxRevisitTime = 
      12.666666666666666
    
    

    Visualize the revisit times that the camera photographs of the location.

    play(sc);

    Input Arguments

    collapse all

    Conical sensor, specified as a ConicalSensor object.

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

    Example: 'LineWidth',2.5 sets the line width of the field of view to 2.5 pixels.

    Satellite scenario viewer, specified as a scalar, vector, or array of satelliteScenarioViewer objects. If the AutoSimulate property of the scenario is false, adding a satellite to the scenario disables any previously available timeline and playback widgets.

    Number of contour points used to draw the contour of the field of view, specified as an integer greater than or equal to 4.

    Data Types: double

    Visual width of the field of view contour in pixels, specified as a scalar in the range (0 10].

    The line width cannot be thinner than the width of a pixel. If you set the line width to a value that is less than the width of a pixel on your system, the line displays as one pixel wide.

    Color of field of view contour, specified as an RGB triplet, hexadecimal color code, a color name, or a short name.

    For a custom color, specify an RGB triplet or a hexadecimal color code.

    • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range [0,1], for example, [0.4 0.6 0.7].

    • A hexadecimal color code is a string scalar or character vector that starts with a hash symbol (#) followed by three or six hexadecimal digits, which can range from 0 to F. The values are not case sensitive. Therefore, the color codes "#FF8800", "#ff8800", "#F80", and "#f80" are equivalent.

    Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.

    Color NameShort NameRGB TripletHexadecimal Color CodeAppearance
    "red""r"[1 0 0]"#FF0000"

    Sample of the color red

    "green""g"[0 1 0]"#00FF00"

    Sample of the color green

    "blue""b"[0 0 1]"#0000FF"

    Sample of the color blue

    "cyan" "c"[0 1 1]"#00FFFF"

    Sample of the color cyan

    "magenta""m"[1 0 1]"#FF00FF"

    Sample of the color magenta

    "yellow""y"[1 1 0]"#FFFF00"

    Sample of the color yellow

    "black""k"[0 0 0]"#000000"

    Sample of the color black

    "white""w"[1 1 1]"#FFFFFF"

    Sample of the color white

    "none"Not applicableNot applicableNot applicableNo color

    Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB® uses in many types of plots.

    RGB TripletHexadecimal Color CodeAppearance
    [0 0.4470 0.7410]"#0072BD"

    Sample of RGB triplet [0 0.4470 0.7410], which appears as dark blue

    [0.8500 0.3250 0.0980]"#D95319"

    Sample of RGB triplet [0.8500 0.3250 0.0980], which appears as dark orange

    [0.9290 0.6940 0.1250]"#EDB120"

    Sample of RGB triplet [0.9290 0.6940 0.1250], which appears as dark yellow

    [0.4940 0.1840 0.5560]"#7E2F8E"

    Sample of RGB triplet [0.4940 0.1840 0.5560], which appears as dark purple

    [0.4660 0.6740 0.1880]"#77AC30"

    Sample of RGB triplet [0.4660 0.6740 0.1880], which appears as medium green

    [0.3010 0.7450 0.9330]"#4DBEEE"

    Sample of RGB triplet [0.3010 0.7450 0.9330], which appears as light blue

    [0.6350 0.0780 0.1840]"#A2142F"

    Sample of RGB triplet [0.6350 0.0780 0.1840], which appears as dark red

    Example: 'blue'

    Example: [0 0 1]

    Example: '#0000FF'

    Output Arguments

    collapse all

    Field of view of conical sensor, returned as a row vector of FieldOfView objects.

    Note

    When the AutoSimulate property is set to false, the SimulationStatus must equal NotStarted to call the fieldOfView function. Otherwise, use the restart function to reset the SimulationStatus to NotStarted, which erases the simulation data.

    Version History

    Introduced in R2021a