主要内容

clone

Copy online state estimation object

说明

obj_clone = clone(obj) creates a copy of the online state estimation object obj with the same property values.

If you want to copy an existing object and then modify properties of the copied object, use the clone command. Do not create additional objects using syntax obj2 = obj. Any changes made to the properties of the new object created in this way (obj2) also change the properties of the original object (obj).

示例

示例

全部折叠

Create an extended Kalman filter object for a van der Pol oscillator with two states and one output. To create the object, use the previously written and saved state transition and measurement functions, vdpStateFcn.m and vdpMeasurementFcn.m. Specify the initial state values for the two states as [2;0].

obj = extendedKalmanFilter(@vdpStateFcn,@vdpMeasurementFcn,[2;0])
obj = 
  extendedKalmanFilter with properties:

        HasAdditiveProcessNoise: 1
             StateTransitionFcn: @vdpStateFcn
    HasAdditiveMeasurementNoise: 1
                 MeasurementFcn: @vdpMeasurementFcn
     StateTransitionJacobianFcn: []
         MeasurementJacobianFcn: []
                          State: [2×1 double]
                StateCovariance: [2×2 double]
                   ProcessNoise: [2×2 double]
               MeasurementNoise: 1
         HasMeasurementWrapping: 0

Use clone to generate an object with the same properties as the original object.

obj2 = clone(obj)
obj2 = 
  extendedKalmanFilter with properties:

        HasAdditiveProcessNoise: 1
             StateTransitionFcn: @vdpStateFcn
    HasAdditiveMeasurementNoise: 1
                 MeasurementFcn: @vdpMeasurementFcn
     StateTransitionJacobianFcn: []
         MeasurementJacobianFcn: []
                          State: [2×1 double]
                StateCovariance: [2×2 double]
                   ProcessNoise: [2×2 double]
               MeasurementNoise: 1
         HasMeasurementWrapping: 0

Modify the MeasurementNoise property of obj2.

obj2.MeasurementNoise = 2;

Verify that the MeasurementNoise property of original object obj remains unchanged and equals 1.

obj.MeasurementNoise
ans = 
1

输入参数

全部折叠

Object for online state estimation of a nonlinear system, created using one of the following commands:

Output Arguments

全部折叠

Clone of online state estimation object obj, returned as an extendedKalmanFilter, unscentedKalmanFilter or particleFilter object with the same properties as obj.

版本历史记录

在 R2016b 中推出