Main Content

sampleGaussian

Sample state using Gaussian distribution

Since R2019b

Description

state = sampleGaussian(space,meanState,stdDev) returns a sample state of the state space based on a Gaussian (normal) distribution with specified mean, meanState, and standard deviation, stdDev.

example

state = sampleGaussian(space,meanState,stdDev,numSamples) returns a number of state samples. The number is equal to numSamples.

Examples

collapse all

Create an SE(2) state space.

space = stateSpaceSE2;

Specify the mean state, standard deviation, and the number of state samples to return.

meanState = [5 5 pi/3];
stdDev = [0.1 0.1 pi/18];
numSamples = 2;

Sample states of the state space based on a Gaussian distribution.

state = sampleGaussian(space,meanState,stdDev,numSamples)
state = 2×3

    5.0538    5.1834    0.6530
    5.0862    5.0319    0.8190

Input Arguments

collapse all

State space object, specified as a stateSpaceSE2, a stateSpaceDubins, or a stateSpaceReedsShepp object.

Data Types: object

Mean state of the Gaussian distribution for sampling, specified as a 3-element vector of real values.

Example: [5 5 pi/3]

Data Types: single | double

Standard deviation of the Gaussian distribution for sampling, specified as a 3-element vector of nonnegative values.

Example: [0.1 0.1 pi/18]

Data Types: single | double

Number of samples, specified as a positive integer.

Data Types: single | double

Output Arguments

collapse all

State samples, returned as an N-by-3 real-valued matrix. N is the number of samples. Each row of the matrix corresponds to one incidence of state in the state space.

Data Types: single | double

Version History

Introduced in R2019b