%Exercise21
p=1/1000;
r=1/200;
I=p/r;
U=12;
m=U/(1+I);
B=1.2*10^5;
H=3*60*60;
sigmaH2=2*U^2*I/(r*(1+I)^3);
dt=0.1;
t=1:dt:H;
q=exp(-((B-m*t).^2)./(2*sigmaH2*t))*B./sqrt(2*pi*sigmaH2*t.^3);
P=trapz(q)*dt