Simulink PID Controller Tuning

A
Alan · Aug 24, 2021 · 3.6K views
Question
Hi, I am a new user to Simulink. I created a model and added a PID controller. When I tune the controller it says the response should be about 1 second with a 20% overshoot. When I run the model the reality is 1000 seconds with 10,000% overshoot. What could cause this to happen?   I created my own PID controller and modified the coefficients and it seems to be working, but I would definitely like to get the built-in PID controller working since I am spending about 5 hours just to tune my homemade controller.   I have been debugging for about a week now, I am not sure what look for. Any assistance would be greatly appreciated.
Expert Answer
Profile picture of John Williams
John Williams PhD Expert
Answered Sep 4, 2026
Direct Solution Overview (TL;DR)

When tuning an altitude PID controller for a quadrotor in Simulink, the automated PID Tuner linearizes the model around an operating point and drops the constant gravity term (g), treating it as zero. This causes massive overshoots because the controller does not account for the continuous downward load. The permanent fix is adding a gravity compensation feedforward term (F_ff = m * g) directly to the PID output, leaving the feedback loop to regulate only dynamic deviations.

1. The Core Problem: Why the Simulink PID Tuner Causes Overshoot

When designing an altitude hold loop for a quadrotor or vertical hoist, the one-dimensional vertical motion equation is:

z_ddot(t) = (F_lift(t) / m) - g

Where z is altitude, F_lift is total thrust from the PID controller, m is vehicle mass, and g is gravitational acceleration (9.81 m/s²).

Why Linearization Misses Gravity

The Simulink PID Tuner computes a linear state-space approximation around a specific operating point. During linearization, the constant affine term -g disappears in the derivative, leaving a double-integrator plant: P(s) = 1 / (m * s²).

The tuner designs gains assuming zero steady-state downward force. When executed in the full non-linear model, gravity acts as a massive constant input disturbance. The integrator must accumulate substantial error before generating sufficient counter-thrust, creating severe transient overshoot.

2. Two Ways to Solve the Altitude Disturbance

Method A: Gravity Feedforward Compensation (Recommended)

Because gravity is a known physical constant, calculate the base hover force F_hover = m * g and inject it directly via a Sum block at the PID Controller output. The feedback PID now only calculates dynamic correction thrust (ΔF), ensuring fast settling with 0% overshoot.

Method B: High-Bandwidth Disturbance Rejection (Not Recommended)

Attempting to reject gravity by cranking up the integrator gain (Ki) forces high closed-loop bandwidths that amplify sensor noise, saturate actuators, and introduce phase lag into attitude dynamics.

3. Step-by-Step Single-Loop PID Tuner Workflow

  1. Insert Controller: Place the standard PID Controller block from the Continuous library into your feedback path.
  2. Launch Tuner: Open the block dialog and click Tune to automatically linearize the plant model.
  3. Adjust Sliders: Tune the Response Time (bandwidth) and Transient Behavior (aim for a 60°–70° phase margin).
  4. Export Gains: Click Update Block to write the tuned Kp, Ki, Kd, and filter divisor N parameters into Simulink.

4. SISO vs. Coupled MIMO Systems

A full 6-DOF quadrotor with 4 rotor inputs controlling 6 degrees of freedom is a coupled MIMO system. For multi-variable control beyond decoupled SISO loops, use:

  • Robust Control Toolbox (systune): Tunes multiple decentralized PID loops simultaneously with robust stability margins.
  • Simulink Design Optimization: Tunes controllers against non-linear physical constraints such as motor current limits and RPM saturation.
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!