Skip to contentScholarGate
LibraryBookshelfDeskReview StudioAssistant
Sign in
On this page
IntuitionHow it worksWhen to use itStrengths & limitationsCommon pitfallsApplicationsFrequently asked🔒 Read the full methodSourcesRelated methods
Cite this pageSpotted an issue on this page? Report or suggest a fix →
Home›Aerospace›Madgwick Filter
Process / pipelineGradient Descent Filtering

Madgwick Filter

Madgwick IMU and AHRS Algorithms · Also known as: Madgwick AHRS, gradient descent attitude filter

The Madgwick Filter is a computationally lightweight attitude estimation algorithm that fuses inertial measurements (accelerometer, gyroscope) with magnetic measurements (magnetometer) to compute a quaternion orientation. Introduced by Sebastian Madgwick in 2010, the algorithm uses gradient descent optimization to minimize the error between measured and expected sensor outputs, yielding accurate, drift-free attitude estimates on embedded systems with minimal computational cost. The Madgwick Filter is now ubiquitous in consumer electronics, robotics, and aerospace systems.

ScholarGate
  1. Process / pipeline
  2. v1
  3. 3 Sources
  4. PUBLISHED
Cite this page →
Tools & resources
Download slides
Learn & explore

Read the full method

Members only

Sign in with a free account to read this section.

Sign in

Method map

The neighbourhood of related methods — select a node to explore.

Madgwick Filter
AHRSMahony FilterQuaternion AttitudeINS Error ModelProportional Navigation

When to use it

Use Madgwick Filter when you need lightweight, real-time attitude estimation on resource-constrained devices (microcontrollers, mobile phones, wearables). Ideal for applications where Kalman Filter complexity is overkill. Effective indoors and outdoors, in vehicles, drones, and wearables. Deploy when you have a 9-DOF IMU and want to avoid tuning multiple Kalman Filter parameters. Use for consumer electronics, hobby robotics, and real-time control systems.

Strengths & limitations

Strengths
  • Minimal computational cost; implemented in < 100 lines of code; runs on microcontrollers and mobile processors.
  • No matrices or complex linear algebra required; only quaternion algebra and dot products.
  • Provides IMU-only (6-DOF) and MARG (9-DOF) variants; adaptable to available sensors.
  • Single tuning parameter (beta) makes it easy to customize; no covariance matrices or matrix inversions.
Limitations
  • Heuristic, not optimal; does not minimize any formal cost function (unlike Kalman Filter).
  • Performance depends critically on beta (step size); no automatic adaptation if sensor quality or motion changes.
  • Magnetometer disturbance can corrupt heading; requires manual calibration; does not automatically detect or reject bad measurements.
  • Large accelerations (in MARG variant) cause temporary errors as accelerometer misaligns with gravity; filter recovery is heuristic, not principled.

Frequently asked

How do I choose the beta parameter?

Beta controls the rate of gradient descent correction. Start with beta = 0.041 (the value Madgwick used). If the filter is sluggish (slow to respond to motion), increase beta (up to 0.1–0.5). If the filter oscillates or drifts, lower beta (down to 0.01). Tune empirically by watching attitude response to known motions.

What is the difference between IMU (6-DOF) and MARG (9-DOF) variants?

IMU variant uses accelerometer and gyroscope only; it provides roll and pitch but yaw drifts without a reference. MARG variant adds magnetometer for absolute yaw; it provides stable 3-DOF attitude but is sensitive to magnetic distortion. Use IMU for short-duration flights; use MARG for stationary or slow navigation.

Can I run Madgwick Filter on a 32-bit microcontroller?

Yes. The algorithm is very efficient; ARM Cortex-M4 can run it at 200+ Hz. Even 8-bit microcontrollers (with floating-point libraries) can manage 50+ Hz. Performance depends on clock rate and floating-point support. With fixed-point arithmetic, it scales to much slower processors.

How do I detect magnetic disturbance?

Monitor magnetometer magnitude; Earth's field is ~50 micro-Tesla; larger deviation indicates distortion. Compare compass heading (from magnetometer) with heading from gyro integration; large disagreement signals disturbance. Mitigation: temporarily ignore magnetometer updates during disturbance, or reduce its weight (lower beta_m in some variants).

Sources

  1. Madgwick, S. O. H., Harrison, A. J. L., & Vaidyanathan, R. (2011). Estimation of IMU and MARG orientation using a gradient descent algorithm. IEEE International Conference on Rehabilitation Robotics (ICORR), 1–7. link ↗
  2. Madgwick, S. O. H. (2010). An efficient orientation filter for inertial and inertial/magnetic sensor arrays. Report x-io Technologies, University of Bristol, UK. link ↗
  3. Sabatini, A. M. (2006). Quaternion-based extended Kalman filter for determining orientation by inertial and magnetic sensing. IEEE Transactions on Biomedical Engineering, 53(7), 1346–1356. DOI: 10.1109/TBME.2006.875664 ↗

How to cite this page

ScholarGate. (2026, June 3). Madgwick IMU and AHRS Algorithms. ScholarGate. https://scholargate.app/en/aerospace/madgwick-filter

Related methods

AHRSMahony FilterQuaternion Attitude

Which method?

Set this method beside its closest kin and read them side by side — the library lays the books on the table; the choice is yours.

  • AHRSAerospace↔ compare
  • Mahony FilterAerospace↔ compare
  • Quaternion AttitudeAerospace↔ compare
Compare side by side →

Referenced by

AHRSINS Error ModelMahony FilterProportional NavigationQuaternion Attitude

Similar methods

Mahony FilterAHRSINS Error ModelDead ReckoningQuaternion AttitudeKalman Filter for Signal TrackingKalman FilterUnscented Kalman Filter

Related reference concepts

Gyroscopic Motion and PrecessionEM AlgorithmData AssimilationEuler Equations and Rotational MotionThe Geomagnetic Field and Secular VariationCamera Models and Calibration

Spotted an issue on this page? Report or suggest a fix →

ScholarGate — Madgwick Filter (Madgwick IMU and AHRS Algorithms). Retrieved 2026-07-21 from https://scholargate.app/en/aerospace/madgwick-filter · Dataset: https://doi.org/10.5281/zenodo.20539026
Quick facts
Originator
Sebastian Madgwick
Subfamily
Gradient Descent Filtering
Year
2010
Type
Filter algorithm
Related methods
AHRSMahony FilterQuaternion Attitude
ScholarGate

A content-first reference library for research methods — what each one is, how it works, and where it comes from.

Open data (CC-BY)

Explore

  • Library
  • Search the library…
  • Browse by field
  • Fields
  • Journey
  • Compare
  • Which method?

Reference

  • Subjects
  • Atlas
  • Glossary
  • Methodology
  • Philosophy

Your tools

  • Bookshelf
  • Desk
  • Chat

Company

  • About
  • Pricing
  • Contact
  • Suggest a method

Entries are compiled from published sources for reference. Verifying the accuracy and suitability of any information for your own use remains your responsibility.

© 2026 ScholarGate · A research-method reference library
  • Privacy
  • Cookies
  • Terms
  • Delete account