I am writing a Matlab code for a first-order nonlinear singularly perturbed parameterized problem with integral boundary condition. I have successfully achieved the desired order of convergence for the solution u(x) but same is not happening with the parameter \lambda.
At first, I calculated the solution $\{u(x),\lambda\}$ at N=32. Since the exact solution to the problem is not available, therefore I employed the double-mesh principle. For this, I created a double mesh, say xx and obtained the solution $\{U,\Lambda\}$. Then I stored their corresponding errors. In this way, one loop is completed. Then I fixed $N=64$, and repeated the same steps. I observed the convergence rate of $u$ is quadratic but not for $\lambda$. What am i doing wrong? Below is the code.
for r=1:1
epsln=2^(-2*r);
for n=1:1
N=32*2^(n);
%% Shishkin Mesh
alph=2;%min. value of g_u
sigm=min(0.5,2*(epsln/alph)*log(N));%Transition Point
t=unique([linspace(0,sigm,N/2+1),linspace(sigm,1,N/2+1)]);
h=diff(t);%step-size
% Initial Solution
u=1-t.^2;
l=-0.4;
%% Iterated Solution
errU=1;
errL=1;
iter=1;
while (errU >Tol || errL>Tol)
[U,l_new]=Solution_Fun_ex1_Kudu(N,t,u,h,l,epsln);
errU=max(abs(u-U))
errL=abs(l-l_new)
u=U;
l=l_new
iter=iter+1;
end
iter
%Final Solution is stored in [u,l]
%%Doublemesh Function
z=Doublemesh_Fun_kudu(t,N);
hh=diff(z);
%Initial Solution
y=1-z.^2;
ll=-0.4;
%%Iterated Solution
errY=1;
errLd=1;
iterr=1;
while (errY>Tol || errLd>Tol)
[Y,ll_new]=Solution_Fun_ex1_Kudu(2*N,z,y,hh,ll,epsln);
errY=max(abs(y-Y));
errLd=abs(ll-ll_new);
y=Y;
ll=ll_new;
iterr=iterr+1;
end
%Final Double mesh Solution is stored in [y,ll]
%%Calculating Errors
Err=zeros(1,N+1);
for i=1:N+1
Err(i)=abs(u(i)-y(2*i-1));
end
E(r,n)=max(Err)
E_l(r,n)=abs(l-ll);
%%Calculating Rate of Convergence
if n>1
R(r,n-1)=log(E(r,n-1)/E(r,n))/log(2);
R_l(r,n-1)=log(E_l(r,n-1)/E_l(r,n))/log(2);
end
Meshpoints(n)=N;
end
Val_epsln(r)=epsln;
end