This project presents the modelling, analysis, and control of a Spring–Mass–Damper System using MATLAB and Control System Toolbox. The objective is to analyse the dynamic behaviour of the system in both the time domain and frequency domain, then design a Proportional-Integral (PI) controller to improve system performance.
The project was completed as part of the Control Systems (CNS317B) course for the Bachelor of Engineering Technology in Electrical Engineering.
The project aims to:
- Model a Spring–Mass–Damper system using its transfer function.
- Analyse the uncontrolled system.
- Evaluate system stability using multiple control engineering techniques.
- Design and tune a PI controller.
- Improve transient response and eliminate steady-state error.
- Compare uncontrolled and controlled system performance.
The plant transfer function is
[ G(s)=\frac{1}{10s^2+0.4s+100} ]
where
- Mass (m) = 10 kg
- Spring constant (k) = 100 N/m
- Damping coefficient (c) = 0.4 Ns/m
A PI controller was implemented:
[ G_c(s)=\frac{K_ps+K_i}{s} ]
Controller gains used in the MATLAB script:
- Kp = 10
- Ki = 100
The controller was designed to:
- Improve settling time
- Eliminate steady-state error
- Maintain system stability
- Step Response (Uncontrolled)
- Step Response (PI Controlled)
- Open-loop Root Locus
- PI Controlled Root Locus
- Bode Plot
- Gain Margin
- Phase Margin
- Nyquist Plot
The project makes use of the following MATLAB Control System Toolbox functions:
tf()step()stepinfo()feedback()pole()rlocus()bode()margin()nyquist()
.
├── SpringMassDamper_PI_Controller.m # Main MATLAB simulation
├── GA4_Report.pdf # Technical report
├── README.md
The project demonstrates that the PI controller significantly improves system performance by:
- Reducing settling time
- Eliminating steady-state error
- Improving damping
- Maintaining closed-loop stability
- Providing improved frequency-domain stability margins
The generated plots include:
- Step Response
- Root Locus
- Bode Plot
- Nyquist Plot
- MATLAB
- Control System Toolbox
- Clone this repository
git clone https://github.com/yourusername/Spring-Mass-Damper-PI-Controller.git-
Open MATLAB.
-
Navigate to the project folder.
-
Run
SpringMassDamper_PI_ControllerThe script will automatically generate all simulation plots and display the calculated system characteristics.
This project demonstrates understanding of:
- Dynamic system modelling
- Transfer functions
- Time-domain analysis
- Frequency-domain analysis
- Root Locus design
- PI controller design
- Closed-loop stability
- MATLAB Control System Toolbox
TG Maelane
Bachelor of Engineering Technology (Electrical Engineering)
Tshwane University of Technology
Control Systems (CNS317B)
Graduation Attribute 4 (GA4)
System Modelling and Stability Analysis
This repository is intended for educational and academic purposes.