Numerical Laplace Transform

Often times, we are faced with the need to compute the laplace ransfrom of complex function.
523 Downloads
Updated 20 Dec 2016

View License

% Example 1
f1 = @(t) t.^2;
Lapf1 = @(s) LapTrans(f1,s);
sc = 1:0.1:10;
sp = 1:10;
yc = 2./sc.^3;
yp = arrayfun(Lapf1, sp);
figure(1)
plot(sc,yc,'r',sp,yp,'*');
legend('Exact Transformation', 'Approximate Transformation');
title('Numerical Laplace Transform (t^2)')

% Example 2

f1 = @(t) sin(t);
Lapf1 = @(s) LapTrans(f1,s);
sc = 1:0.1:10;
sp = 1:10;
yc = 1./(1 + sc.^2);
yp = arrayfun(Lapf1, sp);
figure(2)
plot(sc,yc,'r',sp,yp,'*');
legend('Exact Transformation', 'Approximate Transformation');
title('Numerical Laplace Transform (sin(t))')

% Example 3

f1 = @(t) besselj(0, t);
Lapf1 = @(s) LapTrans(f1,s);
sc = 1:0.1:10;
sp = 1:10;
yc = 1./sqrt(1 + sc.^2);
yp = arrayfun(Lapf1, sp);
figure(3)
plot(sc,yc,'r',sp,yp,'*');
legend('Exact Transformation', 'Approximate Transformation');
title('Numerical Laplace Transform (besselj(0, t))')

% Example 4
n = 0.358;
f1 = @(t) besselk(n, t);
Lapf1 = @(s) LapTrans(f1,s);
sc = 1:0.1:10;
sp = 1:10;
c = sqrt(-1 + sc.^2);
yc = (pi * (sc + c).^(-n).*(-1 + (sc + c).^(2*n)))./(2*c*sin(n*pi));
yp = arrayfun(Lapf1, sp);
figure(4)
plot(sc,yc,'r',sp,yp,'*');
legend('Exact Transformation', 'Approximate Transformation');
title('Numerical Laplace Transform (besselk(0.358, t))')

Cite As

Lateef Adewale Kareem (2024). Numerical Laplace Transform (https://www.mathworks.com/matlabcentral/fileexchange/60837-numerical-laplace-transform), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Bessel functions in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0