#
# Dæmi 1 bls. 4
#
x=0;
function fx=daemi1(x)
   fx=1-exp(2*x);
   end
x=(1:200)/100-1
plot(x,daemi1(x))

#
#  Daemi 2 bls 4
#
A=[0,-1,2;-2,-1,4;2,7,-3]
B=[-7,1,1;7,-3,-2;3,5, 0]
C=A*B
y=[3;-1;2]
x=C\y
#
# eða
#
x=inv(C)*y
#
C=A.*B
# 
x=C\y
#
#  Daemi 3 bls 5
#
t=(1960:2001)'
eps=randn(length(t),1)*0.2^0.5
y=5+0.05*t+eps
plot(t,y)
x=[ones(length(t),1),t]
betahat=inv(x'*x)*x'*y
epshat=y-x*betahat
