Verified MATLAB & Simulink Project

PID vs Fuzzy Logic Control for DC Motor Using MATLAB Simulink

PID vs Fuzzy Logic Control for DC Motor in MATLAB Simulink – MATLAB Simulation Video
YouTube Watch Full Simulation Free Preview
MATLAB R2020a - R2024b
Zero Convergence Errors
Simscape / SimPowerSystems
Need This Simulation?

Get in touch with our PhD MATLAB simulation team for customized code, parameters, or complete thesis models.

Talk to Simulation Expert
What we offer:
  • Custom MATLAB/Simulink solutions
  • 1-on-1 Expert consultation
  • Flexible pricing & 100% bug-free guarantee

Methodology

1. DC Motor Dynamic Modeling

The separately excited DC motor armature circuit and rotor mechanical system are governed by two coupled differential equations:

Armature Circuit: V_a(t) = R_a * i_a(t) + L_a * (di_a/dt) + e_b(t)

Back EMF: e_b(t) = K_b * w(t)

Mechanical Rotor Equation: J * (dw/dt) + B * w(t) = T_m(t) - T_L(t)

Electromagnetic Torque: T_m(t) = K_t * i_a(t)

Applying the Laplace transform with zero initial conditions yields the transfer function from armature voltage V_a(s) to angular velocity w(s):

G(s) = w(s) / V_a(s) = K_t / ((J*s + B)*(L_a*s + R_a) + K_t*K_b)

For this project simulation, standard industrial motor parameters are configured as follows: Armature Resistance R_a = 1.0 Ohm, Armature Inductance L_a = 0.5 H, Rotor Inertia J = 0.01 kg.m^2, Viscous Friction Coefficient B = 0.1 N.m.s/rad, Torque Constant K_t = 0.01 N.m/A, and Back-EMF Constant K_b = 0.01 V.s/rad.

2. PID Controller Design & Tuning

The classical PID controller generates control action u(t) based on error signal e(t) = w_ref - w_actual:

u(t) = K_p * e(t) + K_i * integral(e(t)dt) + K_d * (de(t)/dt)

Gains K_p, K_i, and K_d were selected using pole placement and fine-tuned using the MATLAB PID Tuner tool to balance speed of response against overshoot.

3. Fuzzy Logic Controller (FLC) Design

The Fuzzy Logic Controller consists of three primary stages:

  • Fuzzification: Takes two inputs: Error e(t) and Change in Error de(t)/dt. Each input uses 5 membership functions: Negative Big (NB), Negative Small (NS), Zero (ZE), Positive Small (PS), and Positive Big (PB).
  • Rule Base & Inference Engine: A 5x5 linguistic rule base (25 rules total) defines controller logic using Mamdani-style minimum inference.
  • Defuzzification: Converts the fuzzy control decision back into a crisp armature voltage adjustment u(t) using the Centroid method.

4. Simulation Setup & Results Analysis

Both control strategies are executed concurrently in a unified MATLAB Simulink block diagram under two test conditions:

  • Unloaded Step Response: A 100 rad/s step command is applied at t = 0s.
  • Disturbance Rejection: A 5 N.m step load torque disturbance is injected at t = 2.5s.

Simulation results demonstrate that while the tuned PID controller achieves rapid initial rise time, the Fuzzy Logic Controller exhibits zero overshoot and recovers faster from sudden load torque changes with minimal transient deviation.

Verified MATLAB Simulation Code Demonstration

Syntax-highlighted executable code demonstration for PID vs Fuzzy Logic Control for DC Motor Using MATLAB Simulink:

MATLAB control_system_design.m
% State-Space Control & Stability Analysis
clc; clear; close all;

% System Matrices
A = [0 1; -4 -5];
B = [0; 1];
C = [1 0];
D = 0;

sys_ss = ss(A, B, C, D);
Co = ctrb(A, B);

% Pole Placement Control
desired_poles = [-3 + 4i, -3 - 4i];
K = acker(A, B, desired_poles);

sys_cl = ss(A - B*K, B, C, D);
fprintf('State Feedback Controller Formulated Successfully!\n');
PID vs Fuzzy Logic Control for DC Motor Using MATLAB Simulink $10.00
$10.00