//Altitude with inertial only measurement
//JLJ 2014
clear ;
close;
simut=20;//total time
ts=1; //sample time
samplesno=simut/ts; //number of samples

sigmav2=2.5e-5;//m^2/s^3
sigmab2=1e-6;//[m^2/s^5]
Pz0=0;
Pv0=0;
Pb0=0;

for i=2:(samplesno+1)
Pz(i)=(Pz0+Pv0*i^2+Pb0*i^4/4)+(sigmav2*i^3/3+sigmab2*i^5/20)
Pv(i)=(Pv0+Pb0*i^2)+(sigmav2*i+sigmab2*i^3/3)
Pb(i)=Pb0+sigmab2*i
end
figure('Figure_name','Error Variance Vs Time','Backgroundcolor',[1,1,1])
subplot(311)
axes = gca();
axes.font_size = 3;
x_label=axes.x_label;
y_label=axes.y_label
x_label.font_size=3;
y_label.font_size=3;
plot(t=0:samplesno,Pz,'red');
xlabel('t [s]')
ylabel('Altitude Error Deviation [m]')

xgrid
subplot(312)
axes = gca();
axes.font_size = 3;
x_label=axes.x_label;
y_label=axes.y_label
x_label.font_size=3;
y_label.font_size=3;
plot(t=0:samplesno,Pv,'blue');
xlabel('t [s]')
ylabel('Velocity Error Deviation [m/s]')
xgrid
subplot(313)
axes = gca();
axes.font_size = 3;
x_label=axes.x_label;
y_label=axes.y_label
x_label.font_size=3;
y_label.font_size=3;
plot(t=0:samplesno,Pb,'black');
xgrid
xlabel('t [s]')
ylabel('b Error Deviation [m/s^2]')
