function u = kdv2(x,t) %KDV2 - Korteweg-de Vries Double Soliton Function % % kdv2(x,t) computes the value u(x,t) of an interacting % double soliton solution of the KdV equation % % u_t - uu_x + u_xxx = 0 % % the KdV equation. t is a scalar and x is a scalar or % a vector. % Created: 6/95 by R. Knobel % Parameters k1,k2,eta1,eta2 can be adjusted to alter % the speeds and amplitudes of the double soliton k1 = 1; k2 = 2; eta1 = 0; eta2 = 0; % A = ( (k1-k2)/(k1+k2) )^2; w1 = k1^3; w2 = k2^3; phi1 = exp(w1*t - k1*x + eta1); phi2 = exp(w2*t - k2*x + eta2); u = 2*(k1^2 * phi1 + k2^2 * phi2 + 2*(k1-k2)^2*phi1.*phi2 + ... A*(k2^2 * phi1 + k1^2 + phi2) .* phi1 .* phi2) ./ ... (1+phi1+phi2+A.*phi1.*phi2).^2;