Laplace Transform Differential Equations in MATLAB Programming

MATLAB Illustration

The Laplace Transform is a fundamental mathematical tool for analyzing dynamic systems in control engineering, electrical circuits, and mechanical vibrations. It converts time-domain differential equations into algebraic equations in the complex frequency domain ((s)-domain), making complex system responses significantly easier to solve.

In MATLAB, the Symbolic Math Toolbox allows you to perform Laplace transforms, solve for the (s)-domain transfer function, and apply the inverse Laplace transform to obtain exact time-domain analytical solutions using laplace(), ilaplace(), and solve().

Mathematical Foundation of the Laplace Transform

The Laplace transform converts a time-domain function (f(t)) into its (s)-domain equivalent (F(s)):

[F(s) = mathcal{L}{f(t)} = int_{0}^{infty} e^{-st} f(t) , dt]

Using this transformation, time derivatives convert into algebraic terms involving initial conditions:

[mathcal{L}{f'(t)} = s F(s) - f(0)] [mathcal{L}{f''(t)} = s^2 F(s) - s f(0) - f'(0)]

Step-by-Step Examples

Example 1: Solving a First-Order Linear Differential Equation

Consider the first-order differential equation:

[frac{dy(t)}{dt} + 3y(t) = 6 quad text{with initial condition } y(0) = 2]
MATLAB
syms y(t) s  % Define equation and symbolic Laplace representation Dy = diff(y, t);
eqn = Dy + 3*y == 6;
% Take Laplace transform of the equation Y = laplace(y, t, s);
eqnLaplace = laplace(eqn, t, s);
% Substitute symbolic Laplace term and initial condition y(0) = 2 eqnLaplace = subs(eqnLaplace, laplace(y, t, s), Y);
eqnLaplace = subs(eqnLaplace, y(0), 2);
% Solve for Y(s) in Laplace domain Y_s = solve(eqnLaplace, Y);
% Compute inverse Laplace transform to get y(t) y_t = ilaplace(Y_s, s, t)

Output:

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

This result shows an exponential decay settling toward a steady-state value of 2.

Example 2: Solving a Second-Order Differential Equation

Solve the second-order homogeneous differential equation:

[y''(t) + 5y'(t) + 6y(t) = 0 quad text{with } y(0) = 1, ; y'(0) = 0]
MATLAB
syms y(t) s  % Define derivatives and differential equation Dy = diff(y, t);
D2y = diff(y, t, 2);
eqn = D2y + 5*Dy + 6*y == 0;
% Transform equation to s-domain Y = laplace(y, t, s);
eqnLap = laplace(eqn, t, s);
% Substitute initial conditions y(0) = 1 and y'(0) = 0 eqnLap = subs(eqnLap, laplace(y, t, s), Y);
eqnLap = subs(eqnLap, y(0), 1);
eqnLap = subs(eqnLap, subs(diff(y, t), t, 0), 0);
% Solve for Y(s) and compute inverse Laplace transform Y_s = solve(eqnLap, Y);
y_t = ilaplace(Y_s, s, t)

Output:

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

Plotting System Response in MATLAB

Visualize the resulting time-domain analytical solution over a 5-second window using fplot():

MATLAB
figure;
f
plot(y_t, [0, 5], 'LineWidth', 1.5, 'Color', 'b');
title('Response of Second-Order System y(t)');
xlabel('Time t (seconds)');
ylabel('Amplitude y(t)');
grid on;

Key Summary

  • Use laplace() to convert time-domain differential equations into algebraic (s)-domain expressions.
  • Use subs() to inject physical initial conditions (y(0)) and (y'(0)).
  • Use solve() to isolate (Y(s)) algebraically.
  • Use ilaplace() to convert the solved (s)-domain expression back to a time-domain equation (y(t)).
  • Use fplot() to visualize transient and steady-state time responses.

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.

MATLAB Autonomous Vehicle Path Planning Project for Students: Step-by-Step with Code

One of the most fascinating and sought-after projects for engineering students is autonomous vehicles. One of the main challenges in the development of self-driving cars is path planning, which is the process of determining a safe, collision-free route from start to o

Battery Management System (BMS) in Electric Vehicles Using MATLAB & Simulink: A Comprehensive Guide

The Battery Management System (BMS) serves as the intelligent brain of an electric vehicle (EV) battery pack. It ensures safety, maximizes performance, extends battery life, and optimizes energy usage in real-world driving conditions. As EVs become mainst