Main Content

residual

Compute residual and residual covariance for ahrsfilter

Since R2024a

Description

[res, resCov]= residual(FUSE,accelData,gyroData,magData) computes the residual, res, and the residual covariance, resCov, from accelerometer, gyroscope, and magnetometer sensor data.

Examples

collapse all

Load the rpy_9axis file, which contains recorded accelerometer, gyroscope, and magnetometer sensor data from a device oscillating in pitch (around y-axis), then yaw (around z-axis), and then roll (around x-axis). The file also contains the sample rate of the recording.

ld = load('rpy_9axis.mat');
accel = ld.sensorData.Acceleration;
gyro = ld.sensorData.AngularVelocity;
mag = ld.sensorData.MagneticField;

Create a AHRS filter object with sample rate equal to the frequency of the data. Set the decimation factor value to 2.

Fs = ld.Fs;  % Hz
fuse = ahrsfilter(SampleRate=Fs,DecimationFactor=2);

Compute the residual value and the residual covariance for AHRS filter.

[res,resCovar] = residual(fuse,accel,gyro,mag);

Input Arguments

collapse all

Filter object, specified as an ahrsfilter object.

Accelerometer data, specified as a N-by-3 matrix. Units are in m2/s.

Data Types: single | double

Gyroscope data, specified as a N-by-3 matrix. Units are in rad/s.

Data Types: single | double

Magnetometer data, specified as a N-by-3 matrix. Units are in μT.

Data Types: single | double

Output Arguments

collapse all

Measurement residual, returned as an M-by-6 matrix. M is computes as N/DecimationFactor. Decimator factor is specified by the DecimationFactor property of the input ahrsfilter object.

Data Types: double

Residual covariance, returned as a 6-by-6-by-M array.

Data Types: double

Version History

Introduced in R2024a