clear all, clc;

%%
%Beispiel 1:
f=@(t) zeros(length(t),1);
p=@(t) -ones(length(t),1);
q=@(t) zeros(length(t),1);
r=@(t) ones(length(t),1);

a=0;
b=pi/2;

alpha=0;
beta=1;

err=[];

for N=[10 50 100 500 1000];

u = FDM(f,p,q,r,a,b,N,alpha,beta);
t = linspace(a,b,N+2);
err=[err max(abs(u-sin(t')))];

end

semilogy(err,'b')

err=[];

%% 
% Beispiel 2:
for epsilon=[1 0.1 0.01]
    f=@(t) zeros(length(t),1);
    p=@(t) epsilon*ones(length(t),1);
    q=@(t) ones(length(t),1);
    r=@(t) zeros(length(t),1);


    a=1;
    b=0;

    alpha=0;
    beta=1;

    err=[];

    for N=[10 50 100 500 1000];
        u = FDM(f,p,q,r,a,b,N,alpha,beta);
        t = linspace(a,b,N+2);
        plot(t,u)
        pause
    end
    
end

semilogy(err,'b')