Main Content


Compute residual and residual covariance for imufilter

Since R2024a


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


collapse all

Load the rpy_9axis file, which contains recorded accelerometer and gyroscope 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;

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

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

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

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

Input Arguments

collapse all

Filter object, specified as an imufilter 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

Output Arguments

collapse all

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

Data Types: double

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

Data Types: double

Version History

Introduced in R2024a