function [x,t,u] = WOLNA (T, ht, X, hx, a)
nt = round(T./ht); nx = round(X./hx);
u = zeros(nt+1,nx+1); gam = zeros(nx+1);
gam = 0.5.*(ht.*a./hx).^2.0;
x = zeros(nx+1); u = zeros (nt+1, nx +1); t = zeros(nt+1);
for j = 1 : 1: nx+1
x(j) = (j - 1).*hx;
u(1,j) = mu3(x(j));
end
t(1) = 0.0;
for i = 2 : 1 : nt+1
t(i) = (i - 1).*ht;
u(i,1) = mu1(t(i));
u(i, nx+1) = mu2(t(i));
end
for j = 2 : 1 : nx
u(2,j) = u(1, j) + 0.5.*gam.*(u(1,j-1) - 2.0.*u(1,j) + u(1,j+1)) + 0.5.*ht.^2.0.*func(t(1), x(j))+ ht.*mu4(x(j));
end
for i = 2 : 1 : nt
A = zeros(nx-1); B = zeros(nx-1); C = zeros(nx-1); F = zeros(nx-1); xm = zeros(nx-1);
F(1) = u(i - 1, 2) - 2.0.*u(i, 2) - ht.*ht.*func(t(i), x(2)) - ...
gam.*(u(i+1, 1) + u(i-1, 1) -2.0.*u(i-1,2) + u(i-1, 3));
A(1) = 0.0; C(1) = -(1.0 + 2.0.*gam); B(1) = gam;
F(nx - 1) = u(i - 1, nx) - 2.0.*u(i, nx) - ht.*ht.*func(t(i), x(nx)) -...
gam.*(u(i + 1, nx + 1) + u(i-1, nx-1) -2.0.*u(i-1,nx) + u(i-1, nx+1));
A(nx - 1) = gam; C(nx-1) = -(1.0 + 2.0.*gam); B(nx-1) = 0.0;
for j = 2 : 1 : nx-2
F(j) = (1.0 +2.0.*gam).*u(i - 1, j) - 2.0.*u(i, j) - ht.*ht.*func(t(i), x(j))- ...
gam.*(u(i - 1, j - 1) + u(i - 1, j + 1));
A(j) = gam; C(j) = -(1.0 +2.0.*gam); B(j) = gam;
end
xm = progonka(A,B,C,F,nx-1);
for j = 2 : 1 : nx
u(i+1, j) = xm(j-1);
end
end;
endfunction
function z = func (t,x)
z = 0.0;
endfunction
function [ym] = mu1(t)
ym = 0.0;
endfunction
function [ym] = mu2(t)
ym = 0.0;
endfunction
function [ym] = mu3(x)
if (x <=1/3) then
ym = 0.03.*x;
else
ym = 0.015.*(1.0 - x);
end
endfunction
function [ym] = mu4(x)
ym = 0.0;
endfunction
function [xm] = progonka(A,B,C,F,n)
for i = 2: 1: n
m = A(i)./C(i-1);
C(i) = C(i) - m.*B(i-1);
F(i) = F(i) - m.*F(i-1);
end
x(n) = F(n-1)./C(n-1);
for i = n-1 :-1 : 1
x(i) = (F(i) -B(i)*x(i+1))./C(i);
end
xm = x;
endfunction