

%we want to solve by FDM 
%-u''+c*u=0
%u(0)=u(b)=1
%take b=1,2,4,8,16
bb=[1,4,12,14,16];
for b=bb,
% b=1;
 a=0;
 c=1;
 N=300;
 f=@(x) zeros(size(x));
 al=be=1;
## h=(b-a)/N;
## d=ones(N+1,1);
## A=2*diag(d)-diag(d(1:N),1)-diag(d(1:N),-1);
## A=(1/(h*h))*A;
## A+=c*eye(size(A));
## A(1,2)=A(N+1,N)=0;
## A(1,1)=A(N+1,N+1)=1;
##
## F=zeros(N+1,1);
## F(1)=F(end)=1;
## u=A\F;
[u,x]=FDMDsolver(f,a,b,al,be,c,N);
 %%compare wit hshooting method 
 %%-y''+y=0 a=0 b=1 ya=yb=1 (d=c=f)
 d=@(x) 0; f=d;c=@(x) ones(size(x));
 a=0;
% b=1;
 ya=yb=1; 
 [s0,Y,x,erb]=linshoot(d,c,f,a,b,ya,yb,N);
 [b,erb]
 plot(x,u,";FDM;",x,Y(:,1),";shooting method;")
 pause(2);
% plot(x,u-Y(:,1),";difference;");
% pause(1);
end
