measurementJacobian
Description
returns the Jacobian matrix for the measurement function of the jac
= measurementJacobian(sensor
,filter
)sensor
object, inherited from the positioning.INSSensorModel
abstract class.
Note
Implementing this method is optional for a subclass of the positioning.INSSensorModel
abstract class. If you do not implement this
method, the subclass uses a Jacobian matrix calculated by numerical
differentiation.
Examples
Customize a sensor model used with the insEKF
object. The sensor measures the velocity state, including a bias affected by random noise.
Customize the sensor model by inheriting from the positioning.INSSensorModel
interface class and implementing its methods. Note that only the measurement
method is required for implementation in the positioning.INSSensorModel
interface class. These sections provide an overview of how the BiasSensor
class implements the positioning.INSSensorModel
methods, but for details on their implementation, see the details of the implementation in the attached BiasSensor.m
file.
Implement sensorstates
method
To model bias, the sensorstates
method needs to return a state, Bias
, as a structure. When you add a BiasSensor
object to an insEKF
filter object, the filter adds the bias component to the state vector of the filter.
Implement measurement
method
The measurement is the velocity component of the filter state, including the bias. Therefore, return the summation of the velocity component from the filter and the bias.
Implement measurementJacobian
method
The measurementJacobian
method returns the partial derivative of the measurement
method with respect to the state vector of the filter as a structure. All the partial derivatives are 0
, except the partial derivatives of the measurement with respect to the velocity and bias state components.
Implement stateTransition
method
The stateTransiton
method returns the derivative of the sensor state defined in the sensorstates
method. Note that this example only showcases how to set up the method, and does not correspond to any practical application.
Implement stateTransitionJacobian
method
Since the stateTransiton
function does not depend on the state of the filter, the Jacobian matrix is 0.
Create and add inherited object
Create a BiasSensor
object.
biSensor = BiasSensor
biSensor = BiasSensor with no properties.
Create an insEKF
object with the biSensor
object.
filter = insEKF(biSensor,insMotionPose)
filter = insEKF with properties: State: [17×1 double] StateCovariance: [17×17 double] AdditiveProcessNoise: [17×17 double] MotionModel: [1×1 insMotionPose] Sensors: {[1×1 BiasSensor]} SensorNames: {'BiasSensor'} ReferenceFrame: 'NED'
The filter state contains the bias component.
stateinfo(filter)
ans = struct with fields:
Orientation: [1 2 3 4]
AngularVelocity: [5 6 7]
Position: [8 9 10]
Velocity: [11 12 13]
Acceleration: [14 15 16]
BiasSensor_Bias: 17
Show customized BiasSensor
class
type BiasSensor.m
classdef BiasSensor < positioning.INSSensorModel %BIASSENSOR Sensor measuring velocity with bias % Copyright 2021 The MathWorks, Inc. methods function s = sensorstates(~,~) % Assume the sensor has a bias. Define a Bias state to enable % the filter to estimate the bias. s = struct('Bias',0); end function z = measurement(sensor,filter) % Measurement is the summation of the velocity measurement and % the bias. velocity = stateparts(filter,'Velocity'); bias = stateparts(filter,sensor,'Bias'); z = velocity + bias; end function dzdx = measurementJacobian(sensor,filter) % Compute the Jacobian, which is the partial derivative of the % measurement (velocity plus bias) with respect to the filter % state vector. % Obtain the dimension of the filter state. N = numel(filter.State); % The partial derviative of the Bias with respect to all the % states is zero, except the Bias state itself. dzdx = zeros(1,N); % Obtain the index for the Bias state component in the filter. bidx = stateinfo(filter,sensor,'Bias'); dzdx(:,bidx) = 1; % The partial derivative of the Velocity with respect to all the % states is zero, except the Velocity state itself. vidx = stateinfo(filter,'Velocity'); dzdx(:,vidx) = 1; end function ds = stateTransition(~,~,~,~) % Return the derivative of the sensor state with respect to % time as a structure. ds = struct('Bias',0); end function dBiasdx = stateTransitonJacobian(~,filter,~,~) % Since the stateTransiton function does not depend on the % state of the filter, the Jacobian is all zero. N = numel(filter.State); dBiasdx = zeros(1,N); end end end
Input Arguments
Sensor model used with an INS filter, specified as an object inherited from the positioning.INSSensorModel
abstract class.
INS filter, specified as an insEKF
object.
Output Arguments
Jacobian matrix for the measurement equation, returned as an
M-by-N real-valued matrix. M
is the dimension of the sensor measurement, and N is the dimension of
the state maintained in the State
property of the
filter
.
Version History
Introduced in R2022a
See Also
measurement
| sensorstates
| stateTransition
| stateTransitionJacobian
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)