Experiment-7
AIM:
To use MATLAB to compute the Laplace Transform and the Inverse Laplace Transform of
given mathematical functions.
Equations: 1. (i) L{ e2t+ t – t2}
(ii) L{ cos(3x) + sin(5x) e-t}
2. (i) L-1{ 2s/(s2+1) }
SOFTWARE REQUIRED:
A MATLAB based computer system
THEORY:
Laplace transform:
The Laplace transform is a powerful mathematical tool used to analyze linear time-invariant
systems in engineering and physics. It converts a time-domain function f(t), defined for t≥0,
into a complex frequency-domain representation F(s). The transform is given by:
∞
F(s)=∫ f ( t ) e -tdt
0
where s is a complex variable. By simplifying differential equations into algebraic forms, it
facilitates the analysis of circuits, control systems, and signal processing. The Laplace
transform also handles initial conditions and discontinuities effectively, making it crucial for
solving transient and steady-state problems.
Inverse Laplace Transform:
The Inverse Laplace Transform is used to revert the frequency-domain representation back to
the time domain
MATLAB CODE:
1. For Laplace Transform:
Code 1:
syms t s
f_t = exp(2*t) + t - t^2;
L_f = laplace(f_t, t, s);
disp('The Laplace transform of f(t) = e^{2t} + t - t^2 is:');
disp(L_f);
Aryan Sharma (230105015)
Code 2:
syms t s
f = cos(3*t) + exp(-1*t)*sin(5*t);
F=laplace(f , t, s) ;
disp('The Laplace transform of f(t) = cos(3*t) + exp(-1*t)*sin(5*t)’);
disp(F);
2. For Inverse Laplace transform:
Code 3:
syms t s
f= (2*s)/(s^2 +1);
F = ilaplace(f, s, t);
disp(F);
OUTPUT:
The Laplace transform of f(t) = e^{2t} + t - t^2 is:
1/(s - 2) + 1/s^2 - 2/s^3
The Laplace transform of f(t) = cos(3*t) + exp(-1*t)*sin(5*t)
s/(s^2 + 9) + 5/((s + 1)^2 + 25)
2*cos(t)
RESULT:
The experiment demonstrates the computation of Laplace and Inverse Laplace Transforms
using MATLAB.
PRECAUTIONS:
Never use the M-file name in the MATLAB function or command and vice-versa.
Never use number before the file name.
Never use blank space in the file name.
Aryan Sharma (230105015)
Experiment-8
AIM:
To find the solution of the given difference equation:
Y(n)+0.671Y(n-3)+0.25063Y(n-5)-0.25470Y(n-7)=2x(n-2)-x(n-4)+0.8306x(n-6)
SOFTWARE REQUIRED:
A MATLAB based computer system.
THEORY:
A difference equation is a mathematical expression that relates the differences between
successive values of a discrete function. It is analogous to a differential equation but applies
to sequences or discrete-time systems. A difference equation is often used to model dynamic
systems, signal processing, or population growth, where variables change incrementally. It
can be linear or nonlinear, homogeneous or nonhomogeneous, and classified by its order,
which is determined by the highest difference term. The general solution combines a
complementary function and a particular solution. Solving difference equations involves
techniques like iteration, z-transform, or matrix methods, depending on the problem's
complexity.
MATLAB CODE:
a = [1, 0, 0, 0.671, 0, -0.25063, 0, -0.25470];
b = [0, 0, 2, 0, -1, 0.8306];
n = 0:150;
[h, t] = impz(b, a, length(n));
stem(t, h, 'filled');
title('Impulse Response Using impz');
xlabel('n');
ylabel('h(n)');
Aryan Sharma (230105015)
OUTPUT:
Fig 1
RESULT:
The experiment demonstrates the computation of Laplace and Inverse Laplace Transforms
using MATLAB.
PRECAUTIONS:
Never use the M-file name in the MATLAB function or command and vice-versa.
Never use number before the file name.
Never use blank space in the file name.
Aryan Sharma (230105015)