Hi Sara,
this plot
figure(1)
tvec = 0:.01:6;
reliability_d = double(subs(reliability,t,tvec));
rel_d = double(subs(rel,t,tvec));
plot(tvec,reliability_d,tvec,rel_d)
grid on
shows that betwen the two versions, the first one has issues. As you can see, it's even increasing in the second half of the plot.
The second version 'rel' is correct, as verified here using an eigenvalue calculation. (In the last line of your code I upped the significant figures with
). Due to the form of D, with all zeros in the lower left corner, time derivates of variables 1-12 do not depend on variables 13-28. Therefore the problem can be reduced to the upper left 12x12 corner of D.
tvec = 0:.01:6;
rel_d = double(subs(rel,t,tvec));
D12 = D(1:12,1:12);
phi0 = C(1:12);
[V lambda]= eig(D12);
phi0V = phi0*V;
inVSum = sum(inv(V),2);
cof = phi0V.*inVSum';
[tvecx lambdax] = meshgrid(tvec,diag(lambda));
phimat = exp(lambdax.*tvecx);
relnew = cof*phimat;
figure(2)
plot(tvec,relnew,tvec,rel_d +.01)
grid on
rel
[cof;diag(lambda)']
The last line shows that the solution has three exponentials of the form exp(lambda*t) with nonzero coefficients. If you scroll through the somewhat inconvenient rel line, you will find the same ones.
Best Answer