%%Eksempel vassforing og vasstand 



%Plottar sanns.ford til X (vassforing), f(x)
figure()
subplot(1,3,1)

x=0:0.1:10
plot(x, exp(-x),'Linewidth',4)
xlabel('Vassforing (x)')
ylabel('Sannsynsfordeling f(x)')
set(gca,'FontSize',20)
%% Plottar vassforingskurve y=u(x)

y=sqrt(x)
subplot(1,3,2)
plot(x,y,'g','Linewidth',4)
xlabel('Vassforing (x)')
ylabel('Vasstand (y)')
set(gca,'FontSize',20)

%% Plottar sanns.ford. for vasstand Y, g(y)

subplot(1,3,3)
plot(y,2.*y.*exp(-y.^2),'r-','Linewidth',4)
xlabel('Vasstand (y)')
ylabel('Sannsynsfordeling g(y)')
set(gca,'FontSize',20)

%% Plottar sannsford 
figure

x=-8:0.1:10;
y1=normpdf(x,2,2)
plot(x,y1,'b-','LineWidth',4)


y2=exppdf(x,2)
hold
plot(x,y2, 'r-','LineWidth',4)

y3=unifpdf(x,-1.46,5.46)
plot(x,y3, 'm-','LineWidth',4)
xlabel('x')
ylabel('f(x)')
legend('Normal(2,4)', 'Exp(2)','Unif(-1.46,5.46)','location','northwest')
set(gca,'FontSize',20)
