residual
Description
Examples
Compute Residual Values for AHRS Filter
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
FUSE
— Filter object
ahrsfilter
object
Filter object, specified as an
ahrsfilter
object.
accelData
— Accelerometer data
N-by-3 matrix
Accelerometer data, specified as a N-by-3 matrix. Units are in m2/s.
Data Types: single
| double
gyroData
— Gyroscope data
N-by-3 matrix
Gyroscope data, specified as a N-by-3 matrix. Units are in rad/s.
Data Types: single
| double
magData
— Magnetometer data
N-by-3 matrix
Magnetometer data, specified as a N-by-3 matrix. Units are in μT.
Data Types: single
| double
Output Arguments
res
— Measurement residual
M-by-6 matrix
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
resCov
— Residual covariance
6-by-6-by-M array
Residual covariance, returned as a 6-by-6-by-M array.
Data Types: double
Version History
Introduced in R2024a
See Also
ecompass
| ahrsfilter
| imuSensor
| gpsSensor
| quaternion
| tune
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.
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)