IC realibility

Examination times in hours.

t=0:50:1300;
t=t';
% Number of examinations.
nint=length(t);
% Number of functioning circuits.
N=[4128;3682;3204;2934;2581;2531;2109;2059;1697;1790;1467;...
    1508;1056;1165;1203;834;994;590;503;508;737;325;360;620;256;338;220;];
% Estimated reliability. Create a vector for storage.
Rest=zeros(nint-1,1);
% Calculate the estimated value of the reliability.
for i=1:nint-1
    Rest(i,1)=N(i+1)/N(1);
end
% Plot the curve describing the probability of functioning
h=figure;

set(h,'Color','w');
subplot(1,2,1);
plot(t(2:end),Rest,'-k','LineWidth',2);
hold all
title('Estimated and calculated reliability')
% Calculate the exponential function that best fits the sample data
y=log(Rest);
subplot(1,2,2);
plot(t(2:end),y,'-k','LineWidth',2);
title('Using logarithmic scale for R_{est}')
% Calculate the parameter of the line equation
numerator=sum(y.*t(2:end));
denominator=sum(t.^2);
lambda=-numerator/denominator;
% Calculate the reliability
R=exp(-lambda*t);
% Plot the curve
subplot(1,2,1);
plot(t,R,'-g','LineWidth',2);