ControlCraft is a MATLAB-based GUI tool designed to help students, educators, and engineers learn and experiment with control system concepts. Whether you're tuning a PID controller, plotting a root locus, or analyzing a Nyquist diagram, ControlCraft makes control system analysis intuitive and interactive.
- GUI-Based Interaction: Easy-to-use interface for visualizing transfer functions and controllers
- System Analysis:
- Pole-Zero Analysis
- Impulse, Step, and Frequency Response
- Bode, Nyquist, and Root Locus Plots
- Controller Design:
- PID Controller Tuning (Manual and Optimized)
- Closed-Loop Transfer Function Visualization
- Real-World Examples: Pre-set cases to explore classic control problems like inverted pendulums
- Flexible Input Parsing: Accepts both polynomial coefficients and symbolic expressions for transfer functions
- Explicit Multiplication Support: Handles symbolic expressions with explicit multiplication for accurate parsing
src/ # Core MATLAB code and GUI
docs/ # Course notes and supplementary materials
examples/ # Example scripts for users
tests/ # Verification and testing scripts
-
Clone the repository:
git clone https://github.com/<your-username>/ControlCraft.git
-
Install Required MATLAB Toolboxes:
- Control System Toolbox
- Symbolic Math Toolbox
-
Navigate to the src folder in MATLAB:
>> cd('ControlCraft/src')
-
Run the main.m file to start the GUI:
>> main
You can input transfer functions using either:
- Polynomial Coefficients: Enter numbers separated by spaces, e.g.,
1 0 3
represents 1/s² + 0s + 3 - Symbolic Expressions: Use valid MATLAB syntax with explicit multiplication, e.g.,
s*(s+1)
,s^2 + 3*s + 2
- Launch the GUI by running
main.m
- Select a Pre-Set Example or enter your own transfer function
- Adjust Parameters:
- Modify the numerator and denominator
- Use the gain slider to adjust the gain k
- Visualize the Transfer Function:
- View the transfer function in LaTeX format
- Analyze the System:
- Use the Plot button to generate various plots (step response, Bode plot, Nyquist diagram, root locus)
- Design Controllers:
- Switch to the Controller Design tab to manually enter or automatically optimize PID gains
- Symbolic Math Errors:
- Use the
*
operator for multiplication (e.g.,s*(s+1)
instead ofs(s+1)
)
- Use the
- Invalid Transfer Function Inputs:
- Verify numerator and denominator inputs are correctly formatted
- Ensure coefficients are numeric and symbolic expressions use valid MATLAB syntax
- Symbolic Math Toolbox:
- Install via MATLAB's Add-On Explorer if not already present
- GUI Not Launching:
- Run
main.m
from the src directory - Check for missing files or functions in the src folder
- Run
- Always use
*
for multiplication in symbolic expressions - Use correct MATLAB syntax for powers (
^
), multiplication (*
), addition (+
), and subtraction (-
) - Test symbolic expressions in MATLAB's Command Window to ensure correct evaluation
- MATLAB R2020a or newer
- Toolboxes:
- Control System Toolbox
- Symbolic Math Toolbox
Contributions are welcome! See the contributing guide for details.
This project is licensed under the MIT License. See the LICENSE file for details.
- University of Southampton's ELEC2220 Course Materials
- MATLAB Control System Toolbox and Symbolic Math Toolbox
For any inquiries or feedback, please raise an issue on the GitHub repository.