Posts

Showing posts from July, 2025

Numerical Methods

Image
Simulating Dynamics: Unveiling Numerical Methods with MATLAB and Simulink Have you ever wondered how software like Simulink solves those complex differential equations that govern dynamic systems? Or how we can predict the behavior of an electrical circuit, a falling object, or a chemical reaction over time? The answer lies in numerical methods , powerful algorithms that approximate the solutions to Ordinary Differential Equations (ODEs). In the world of digital simulation, we can't truly represent continuous time. Instead, we break time into tiny, discrete steps and use numerical methods to estimate the system's state at each subsequent step. Today, we'll dive into two popular and foundational numerical methods – the Modified Euler Method and the Runge-Kutta (RK4) Method – and see how we can implement and compare them using the power of MATLAB and Simulink. Problem Statement: 1.  The Modified Euler Method (Heun's Method): The standard (Forward) Euler method is simple...

Variant Subsystem

Image
The Power of Flexibility: Mastering Variant Subsystems in Simulink Variant Subsystem: It is a special type of subsystem block in Simulink that contains multiple child subsystems (or blocks) representing different functional implementations. Each child is associated with a variant condition (a logical expression). When the model is compiled or simulated, Simulink evaluates these conditions and activates only the variant whose condition is true. The inactive variants are essentially ignored, as if they don't exist in the model. Example:  A Vehicle Suspension System with Different Damper Types  (e.g., standard, sport, comfort) that require different mathematical models. Let's use a Variant Subsystem to manage this. 1. Standard Damper (MyDamperType = 1): When the condition MyDamperType = 1 met, the standard variant subsystem will be simulated, and other subsystems / variants are ignored. Result: 2. Sport Damper (MyDamperType = 2):   When the condition MyDamperType = 2 m...

Triggered Subsystem

Image
Event-Driven Power: Unleashing Logic with Simulink Triggered Subsystems Triggered Subsystem:  A Triggered Subsystem is a type of Simulink subsystem that only executes its contents (the blocks and signals inside it) when a specific condition is met on its trigger port . Unlike an Enabled Subsystem (which executes while a signal is high), a Triggered Subsystem responds to a change in the trigger signal – typically a rising edge, a falling edge, or either edge. Example:  A Simple Counter Triggered by a Button Press, ( where a counter increments / decrements  only when a "button" is pressed (simulated by a pulse). The counter will hold its value between presses). 1. Rising Edge: W here a counter increments by 1 in every 10 seconds  only   when a "button" is pressed. Result: 2. Falling Edge:  W here a counter decrements by 1 in every 10 seconds  only   when a "button" is pressed. Result: Key Advantages: 1. Event-Driven Execution: Execute logic only ...

Enabled Subsystem

Image
Take Control: How to Use Enabled Subsystems in Simulink Enabled Subsystem: An Enabled Subsystem is a type of Simulink subsystem that only executes its contents (the blocks and signals inside it) when it enable port receives a positive control signal (or a rising edge, depending on configuration). When the enable signal is zero or inactive, the subsystem "pauses" and its internal states hold their last values. Example: A Temperature-Controlled Heater where a "Heater" only turns on (and warms up) when the "Room Temperature" drops below 20 degrees Celsius. 1. Positive Control Signal (Enabled):   If the condition became true, then the system will be enabled, and the logic will be executed. 2. Zero / Inactive Signal (Disabled):   If the condition became false, then the system won't be enabled, and the logic will not be executed. Key Advantages: Conditional Execution: The most obvious benefit – run logic only when needed, saving computational resources. ...