image thumbnail

Numerical Laplace Transform

version 1.0.0.0 (55.4 KB) by Lateef Adewale Kareem
Often times, we are faced with the need to compute the laplace ransfrom of complex function.

421 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 (2022). 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

Community Treasure Hunt

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

Start Hunting!