# How to solve this equation for Laplace transform with matlab?

8 views (last 30 days)
soe min aung on 21 Feb 2020
Commented: soe min aung on 2 Mar 2020 soe min aung on 27 Feb 2020
Thanks you so much for your kindness. When I was calculating your advice, I got a result but not figure. I want to get 3D figure. But I cannot try it. Please help me sir. How to plot for 3D?
syms eta0 L v t x y k k1 k2 s h w
eta0 = 2 ;
L = 100 ;
W = 100 ;
v = 0.14 ;
h = 2;
g = 0.0098;
t = 5.95;
T1 = (eta0*v*t)/(2*L)*(1-cos(pi/50*x)).*(1-cos(pi/100*(y+150))) ;
T2 = (eta0*v*t)/L*(1-cos(pi/50*x)) ;
T3 = (eta0*v*t)/(2*L)*(1-cos(pi/50*x)).*(1-cos(pi/100*(y-150))) ;
R = @(V,L,H,X)heaviside(V-L)*heaviside(H-V)*X
T = simplify( R(x,0,100,R(y,-150,-50,T1) + R(y,-50,50,T2) + R(y,50,150,T3)) )
Lap = laplace(T)
%Double Fourier transform of 'Lap' for 'x' and 'y'.
eta_1 = fourier(Lap,x,k1)
eta_ = fourier(eta_1,y,k2)
%Substituting 'eta_' into 'zeta_1' formula.
w = sqrt(g*k*tanh(k*h))
zeta_1 = (eta_.*s^2)/(cosh(k*h)*(s^2+w^2))
%Inverse Laplace transform of 'zeta_1'.
zeta_ = ilaplace(zeta_1,s,t)
%Double inverse Fourier transform of 'zeta_' for 'k1' and 'k2'.
zeta1 = ifourier(zeta_,k1,x)
zeta = ifourier(zeta1,k2,y)
%For figure.
x=0;100;
y=linspace(-200,200,101)
[X,Y] = meshgrid(x,y);
surf(X,Y,zeta)
Walter Roberson on 28 Feb 2020
Your zeta is a symbolic expression in k and y according to symvar(), but it also contains k2 inside fourier() calls.
Perhaps you should do
kvals = 0:100;
yvals = linspace(-200,200,101);
[K,Y] = meshgrid(kvals, yvals);
Zsym = subs(zeta, {k, y}, {K, Y});
Z = double(Zsym);
surf(K,Y,Z)
However in practice this does not work: after the substitution, double() is not able to resolve some of the values to numeric. I discovered that some of them can be converted to a better form by using simplify(Zsym), but that is slow.
soe min aung on 2 Mar 2020
Thank you so much sir, I want to try it. If I did not know, let me ask you.