stateTransition
Descripción
Ejemplos
Personalizar el modelo de movimiento utilizado con insEKF
Personalice un modelo de movimiento de velocidad constante 1-D utilizado con un objeto insEKF
. Personalice el modelo de movimiento heredando de la clase de interfaz positioning.INSMotionModel
e implemente los métodos modelstates
y stateTranistion
. Opcionalmente, también puede implementar el método stateTransitionJacobian
. Estas secciones proporcionan una descripción general de cómo la clase ConstantVelocityMotion
implementa los métodos positioning.INSMotionModel
, pero para obtener más detalles sobre su implementación, consulte el ConstantVelocityMotion.m
adjunto. $ archivo.
Implementar el método modelstates
Para modelar un movimiento de velocidad constante unidimensional, es necesario devolver solo la posición unidimensional y el estado de velocidad como estructura. Cuando agrega un objeto de filtro ConstantVelocityMotion
a un objeto de filtro insEKF
, el filtro agrega el objeto de filtro Position
y Velocity
componentes al vector de estado del filtro.
Implementar el método stateTransition
El método stateTransition
devuelve las derivadas del estado definido por el modelo de movimiento como estructura. La derivada del Position
es el Velocity
, y la derivada del Velocity
es el 0
.
Implementar el método stateTransitionJacobian
El método stateTransitionJacobian
devuelve las derivadas parciales del método stateTransition
, con respecto al vector de estado del filtro, como una estructura. Todas las derivadas parciales son 0, excepto la derivada parcial de la derivada del componente Position
, que es el Velocity
, con respecto al Velocity
estado, es 1
.
Crear y agregar objeto heredado
Cree un objeto ConstantVelocityMotion
.
cvModel = ConstantVelocityMotion
cvModel = ConstantVelocityMotion with no properties.
Cree un objeto insEKF
con el objeto cvModel
creado.
filter = insEKF(insAccelerometer,cvModel)
filter = insEKF with properties: State: [5x1 double] StateCovariance: [5x5 double] AdditiveProcessNoise: [5x5 double] MotionModel: [1x1 ConstantVelocityMotion] Sensors: {[1x1 insAccelerometer]} SensorNames: {'Accelerometer'} ReferenceFrame: 'NED'
El estado del filtro contiene los componentes Position
y Velocity
.
stateinfo(filter)
ans = struct with fields:
Position: 1
Velocity: 2
Accelerometer_Bias: [3 4 5]
Mostrar clase ConstantVelocityMotion
personalizada
type ConstantVelocityMotion.m
classdef ConstantVelocityMotion < positioning.INSMotionModel % CONSTANTVELOCITYMOTION Constant velocity motion in 1-D % Copyright 2021 The MathWorks, Inc. methods function m = modelstates(~,~) % Return the state of motion model (added to the state of the % filter) as a structure. % Since the motion is 1-D constant velocity motion, % retrun only 1-D position and velocity state. m = struct('Position',0,'Velocity',0); end function sdot = stateTransition(~,filter,~, varargin) % Return the derivative of each state with respect to time as a % structure. % Deriviative of position = velocity. % Deriviative of velocity = 0 because this model assumes constant % velocity. % Find the current estimated velocity currentVelocityEstimate = stateparts(filter,'Velocity'); % Return the derivatives sdot = struct( ... 'Position',currentVelocityEstimate, ... 'Velocity',0); end function dfdx = stateTransitionJacobian(~,filter,~,varargin) % Return the Jacobian of the stateTransition method with % respect to the state vector. The output is a structure with the % same fields as stateTransition but the value of each field is a % vector containing the derivative of that state relative to % all other states. % First, figure out the number of state components in the filter % and the corresponding indices N = numel(filter.State); idx = stateinfo(filter); % Compute the N partial derivatives of Position with respect to % the N states. The partial derivative of the derivative of the % Position stateTransition function with respect to Velocity is % just 1. All others are 0. dpdx = zeros(1,N); dpdx(1,idx.Velocity) = 1; % Compute the N partial derivatives of Velocity with respect to % the N states. In this case all the partial derivatives are 0. dvdx = zeros(1,N); % Return the partial derivatives as a structure. dfdx = struct('Position',dpdx,'Velocity',dvdx); end end end
Argumentos de entrada
model
— Modelo de movimiento utilizado con filtro INS
objeto heredado de positioning.INSMotionModel
clase
Modelo de movimiento usado con un filtro INS, especificado como un objeto heredado de la clase abstracta positioning.INSMotionModel
.
filter
— filtro INS
insEKF
objeto
Filtro INS, especificado como un objeto insEKF
.
dt
— Filtrar paso de tiempo
escalar positivo
Paso de tiempo del filtro, especificado como un escalar positivo.
Tipos de datos: single
| double
Argumentos de salida
statedot
— Derivados de estados
estructura
Derivados de los estados, devueltos como estructura. Los nombres de los campos deben ser exactamente iguales a los de la estructura devuelta por el método modelstates
de model
. Los valores de campo son las correspondientes derivadas temporales de los estados del sensor.
Historial de versiones
Introducido en R2022a
Consulte también
Comando de MATLAB
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)