clear all
clc

n=10000;

for i=2:n
u1= rand;
x(1) = 10*rand;
z=random('normal',5,2);

if u1<=fun1_prob2(x(i-1),z);
    x(i)=z;
else
    x(i)=x(i-1);
end;

mean1(i) = mean(x);
var1(i) =var(x);

end

figure(1)
hist(x);
     title(['Histogram of values ']);
     saveas(figure(1),['Histogram prob2.png'])

figure(2)
plot(x);
     title(['Evolution of']);
     saveas(figure(2),['Histogram MC-Values prob2.png'])
     
figure(3)
plot(mean1);

figure(4)
plot(var1);

mean1(n)
var1(n)

%      title(['Density Function f(x)']);
%      saveas(figure(2),['Density Function prob1.png'])