Laplace Transform Differential Equations in MATLAB Programming

MATLAB Illustration

Introduction

The Laplace Transform is one of the most powerful tools for solving differential equations in engineering and mathematics. It converts complex time-domain differential equations into simpler algebraic equations in the Laplace domain.

In MATLAB, solving differential equations using Laplace transforms becomes fast and accurate with the help of symbolic math functions such as laplace(), ilaplace(), and solve().

This approach is widely used in control systems, electrical circuits, and mechanical system modeling.


???? What Is the Laplace Transform?

The Laplace Transform converts a time-domain function f(t)f(t) into an s-domain function F(s)F(s):

F(s)=L{f(t)}=∫0∞e−stf(t) dtF(s) = mathcal{L}{f(t)} = int_{0}^{infty} e^{-st}f(t),dt

Using this transformation, derivatives become algebraic terms:

L{f′(t)}=sF(s)−f(0)mathcal{L}{f'(t)} = sF(s) - f(0) L{f′′(t)}=s2F(s)−sf(0)−f′(0)mathcal{L}{f''(t)} = s^2F(s) - sf(0) - f'(0)

This simplifies solving differential equations immensely.


???? Example 1: Solving a First-Order Differential Equation

Consider the differential equation:

dy(t)dt+3y(t)=6frac{dy(t)}{dt} + 3y(t) = 6

with the initial condition y(0)=2y(0) = 2.

MATLAB Code:

 
syms y(t) s Dy = diff(y, t); eqn = Dy + 3*y == 6; Y = laplace(y, t, s); eqnLaplace = laplace(eqn, t, s); y0 = 2; % Substitute initial condition eqnLaplace = subs(eqnLaplace, laplace(y, t, s), Y); eqnLaplace = subs(eqnLaplace, y(0), y0); % Solve for Y(s) Y_s = solve(eqnLaplace, Y); % Get y(t) using inverse Laplace transform y_t = ilaplace(Y_s, s, t)

Output:

 
y_t = 2*exp(-3*t) + 2

? The solution shows an exponential decay plus a steady-state value — a typical first-order response.


???? Example 2: Second-Order Differential Equation

Let’s solve:

y′′(t)+5y′(t)+6y(t)=0y''(t) + 5y'(t) + 6y(t) = 0

with initial conditions y(0)=1y(0) = 1, y′(0)=0y'(0) = 0.

MATLAB Code:

 
syms y(t) s Dy = diff(y, t); D2y = diff(y, t, 2); eqn = D2y + 5*Dy + 6*y == 0; Y = laplace(y, t, s); eqnLap = laplace(eqn, t, s); % Substitute Laplace and initial conditions eqnLap = subs(eqnLap, laplace(y, t, s), Y); eqnLap = subs(eqnLap, y(0), 1); eqnLap = subs(eqnLap, diff(y, t)(0), 0); % Solve for Y(s) Y_s = solve(eqnLap, Y); % Inverse Laplace to find y(t) y_t = ilaplace(Y_s, s, t)

Output:

 
y_t = exp(-2*t) - exp(-3*t)

? The result represents a second-order underdamped system, often used in control system dynamics.


???? Visualization

You can plot the result in MATLAB:

 
fplot(y_t, [0, 5]) title('Response of Differential Equation using Laplace Transform') xlabel('Time (t)') ylabel('y(t)') grid on

This helps visualize the system’s transient and steady-state behavior.


???? Key Takeaways

  • Use laplace() and ilaplace() for forward and inverse transforms.

  • Use solve() to find expressions in the Laplace domain.

  • Great for solving first and second-order differential equations.

  • Commonly used in control system, electrical, and mechanical applications.

  • Simplifies mathematical modeling by converting calculus into algebra.


? Conclusion

Solving differential equations using the Laplace Transform in MATLAB provides a clean and symbolic method to find exact solutions. It eliminates the complexity of manual differentiation and integration, making it a preferred technique in engineering analysis and design.

With MATLAB’s symbolic toolbox, you can easily transform, solve, and visualize system responses for real-world applications.

What Our Students Say

★★★★★

“I got full marks on my MATLAB assignment! The solution was perfect and delivered well before the deadline. Highly recommended!”

Aditi Sharma, Mumbai
★★★★☆

“Quick delivery and excellent communication. The team really understood the problem and provided a great solution. Will use again.”

John M., Australia

Latest Blogs

Explore how MATLAB Solutions has helped clients achieve their academic and research goals through practical, tailored assistance.

MCP-Enabled Robotics Control Systems with MATLAB

In today\\\'s rapidly advancing era of automation, robotics control systems are evolving to meet the demand for smarter, faster, and more reliable performance. Among the many innovations driving this transformation is the use of MCP (Model-based Control Paradigms)

LLM-Driven Financial Forecasting Models in MATLAB

The financial sector is witnessing a technological revolution with the rise of Large Language Models (LLMs). Traditionally used for text analysis, LLMs are now being integrated with powerful platforms like MATLAB to develop financial forecasting models