%Plottar Gamma fordeling saman med normal
a=100;
b=10;
%Finn passande x-verdiar:
x = gaminv((0.005:0.01:0.995),a,b);
y = gampdf(x,a,b);
y1 = normpdf(x,a*b,b^2);
plot(x,y,'-',x,y1,'-.','LineWidth',2)
legend('Gamma, a=10, b=100','Normal, \mu=ab, \sigma^2=b^2')



%Plottar hasardfunksjon for Weibull
a=1
b=1
t = 0:0.01:1.5;
h = wblpdf(t,a,b) ./ (1-wblcdf(t,a,b));
plot(t,h,'k-', 'LineWidth',2)
hold
a=1
b=1.5
h = wblpdf(t,a,b) ./ (1-wblcdf(t,a,b));
plot(t,h,'g-', 'LineWidth',2)
a=1
b=2

h = wblpdf(t,a,b) ./ (1-wblcdf(t,a,b));
plot(t,h,'r-', 'LineWidth',2)
a=1
b=0.5
h = wblpdf(t,a,b) ./ (1-wblcdf(t,a,b));
plot(t,h,'b-', 'LineWidth',2)
legend('b=1', 'b=1.5', 'b=2','b=0.5')


%Plottar Gamma fordeling saman med normal
a=100;
b=10;
%Finn passande x-verdiar:
x = gaminv((0.005:0.01:0.995),a,b);
y = gampdf(x,a,b);
y1 = normpdf(x,a*b,b^2);
plot(x,y,'-',x,y1,'-.','LineWidth',2)
legend('Gamma, a=10, b=100','Normal, \mu=ab, \sigma^2=b^2')
