function bolgepakker

clear all;
N = 1200;
x = linspace(-30,30,N);

% Reflektert pakke
for i = 1:N
    yr(i)=0.25*exp(-0.1*(x(i)+15)^2)*cos(6*x(i));
    yt(i)=1.0*exp(-0.1*(x(i)-15)^2)*cos(3*x(i));
end;
tsum = 0.0;
rsum = 0.0;
for i = 1:N
    tsum = tsum + yt(i)^2;
    rsum = rsum + yr(i)^2;
end;
plot(x,yr,x,yt);
xlabel('Posisjon');
ylabel('Utsving');
forholdet = 2*rsum/tsum