Hi, I posted this question before with a slight type error in the code. I post it again now after correcting it. Solitar

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Hi, I posted this question before with a slight type error in the code. I post it again now after correcting it. Solitar

Post by answerhappygod »

Hi, I posted this question before with a slight type error in
the code. I post it again now after correcting it.
Solitary-wave interaction: (using matlab)
Use the code section5.m, to study the interaction of solitary
waves in the Whitham equation. Show that a dispersive tail appears
after the interaction, and provide evidence that these oscillations
are not due to numerical instability.
Hi I Posted This Question Before With A Slight Type Error In The Code I Post It Again Now After Correcting It Solitar 1
Hi I Posted This Question Before With A Slight Type Error In The Code I Post It Again Now After Correcting It Solitar 1 (7.57 KiB) Viewed 29 times
section5.m:
%isospectral integration of u_t + uu_x + K*u = 0
% K = fourier transform of dis(k)
N = 512; %input('N=')
L = 8;
a = L/(2*pi);
T = 1.1; %input('T=')
h = 2*pi/N;
dt = .005;
y = a*(h:h:2*pi)';
c1 = 2;
u = exp(-c1*a*(y-pi).^2)/a;
k = [(1:N/2)'; (1-N/2:-1)'];
dis = [1; sqrt(tanh(k)./k)];
Dv = [0; k];
m = a^(-3)*.5*dt*dis.^3;
d1 = (1+i*m)./(1-i*m);
d2 = -.5*i*dt*Dv./(1-i*m);
d3 = .5*d2;
sol = plot(y, a*u, 'r', 'Erasemode', 'background');
box off;
axis([ 0 L -.2 1.75]);
title('Whitham Equation, weak dispersion');
text(1, 1.6, 'dispersion relation = (tanh(k)/k)^{1/2}')
text(1, 1.4, 'u_t + uu_x + K*u = 0, u(x,0) = 2\pi
exp(-2(x-4)^2)/8')
t=0;
while t<T
fftu = fft(u);
fftuu = fft(u.^2);
v = real(ifft(d1.*fftu + 0.5*d2.*fftuu));
w = real(ifft(d1.*fftu + d2.*fftuu));
for n = 1:3
w = v + real(ifft(d3.*fft(w.^2)));
end
u = w;
t = t + dt;
set(sol, 'ydata', a*u);
drawnow;
end
The full Whitham equation is written as nt + mz+K*nz = 0. (2)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply