This project investigates the nonlinear dynamics of a rotational steel shaft under motor-applied torque as a multidomain system. It compares MATLAB (with friction) and Simulink simulations (without friction). A custom GUI synchronizes MATLAB and Simulink/Simscape results in a linked animation for direct visual comparison over time. Validation is achieved by examining peak responses in graphs and through numerical comparison. The study demonstrates how friction influences shaft behavior, providing insight for the design and control of rotational systems.
- Integrated MATLAB and Simulink simulations
- Interactive and Unified
- Adjustable shaft properties and torques
- Real-time visualization of torque, angular displacement, and friction effects
- Wrapped angular position (θ) graphs
- Synchronized and timed graphs and animations of the shaft face
- Full rotation counter
- Simulation control panel to run, clear, and replay results
- shaftDynamicsSimulator.mlapp
- GUI for the project
- Provides controls to run simulations
- Visualize MATLAB & Simulink results together
- animateShaftFace.m
- Animates the end view of the rotating shaft with a pointer
- Synchronizes MATLAB and Simulink simulation outputs
- rotationalFunction.m
- MATLAB function that solves the shaft dynamics numerically
- Generates plots of angular position
- rotationalODE.m
- Defines the system of ordinary differential equations (ODEs) for a simple rotating disc
- Used by rotationalFunction.m
- shaftSimulator.m
- Runs the Simulink model from MATLAB
- Extracts angular position plots angular motion in the App Designer
- rotationalMotionSimulation.slx
- Simulink model of the rotating shaft system
- Generates angular position/velocity outputs
- userinput.m
- Utility function to access numeric field values from the App Designer GUI
- The Simulink model represents the shaft as a physical system with torsional inertia, damping, and applied torque.
- It runs without friction to provide a baseline comparison to the MATLAB simulation (which includes friction).
- All inputs, such as applied torque and shaft properties, are linked to the GUI.
- The simulation outputs angular displacement over time, which is synchronized with the MATLAB results in the GUI animation.
To run this project successfully, follow these steps:
- Clone or download the repository
git clone https://github.com/kbedros9090/ShaftDynamicsSimulatorProject.git
- Ensure all project files are in the same folder
- MATLAB code and app and Simulink models
- Ignore image folder
- Install required software and toolboxes
- MATLAB (recommended version: R2023a or later)
- Simulink
- MATLAB App Designer
- Simscape (for physical modeling components)
- Add the project folder to MATLAB path
- Open MATLAB → Home → Set Path → Add Folder → Save
- Make sure each subfolder is linked to the main project folder
-
Launch the simulation GUI
- Run
shaftDynamicsSimulator
in MATLAB to open the App Designer interface
- Run
-
Adjust simulation parameters at any time
- All shaft properties, applied torques, and simulation settings are fully editable through the GUI
-
Run the simulation
- Click the Run button to generate graphs of the results
-
Animate the simulation
- After checking Animate, click Run again to generate the animated visualization
-
Known Issues
- Rapid repeated runs may cause errors
- Incorrect or incompatible parameters can prevent execution
- Missing files or unconfirmed settings can break animations
- Visualize and analyze results
- Torque, angular displacement, and friction effects are displayed in the graphs
- Full rotations are marked
Parameter | Description |
---|---|
inertia | Shaft rotational inertia |
appliedTorque | Torque applied to the shaft |
friction | Friction torque |
damping | Damping coefficient |
Simulation settings | Duration, step size, GUI options |
Simulation results were validated by comparing peak shaft responses with theoretical predictions. Graphs and GUI animations illustrate how friction and damping affect system behavior. MATLAB simulations (with friction) and Simulink simulations (without friction) can be directly compared for deeper insight.
The project includes two images in the images/
folder:
- GUI Interface (
GUIInterface.png
) - Simulink block model (
SimulinkModel.png
)
Contributions are welcome! You can fix bugs, add features or examples, improve documentation or tests, and suggest enhancements.
To contribute, fork the repo, create a branch, commit your changes, and open a pull request.
This project is licensed under the MIT License. See the LICENSE file for full details.