%% Exercice 2
N1=100;
plot(5*ones(1,100),'g');
hold on;
for n1=50:N1
    ech=randn(1,n1)*sqrt(2)+5;
    R1=[mean(ech)-sqrt(var(ech)/n1)*qt(0.975,n1-1),mean(ech)-sqrt(var(ech)/n1)*qt(0.975,n1-1)];
    plot([n1,n1],[mean(ech)-sqrt(var(ech)/n1)*qt(0.975,n1-1),mean(ech)-sqrt(var(ech)/n1)*qt(0.975,n1-1)]);
    hold on;
end
%%
B2=1000;
n2=100;
ech1=randn(1,100)
R2=[];
v2=var(ech1,1);
for b2=1:B2
    ech2=ech1(randi([1,100],1,100));
    R2=[R2,var(ech2,1)];
end
V2=cumsum(R2)./[1:B2];
W2=V2-v2;
plot(W2,'g');
hold on;
%%

