You are right, the ones(4) was a residual from a previous example. The use of 1.0e-9 instead of 0.0 was to avoid the risk of divisions by zero. Now the figure shows a better change at t=1000:

Thanks
You are right, the ones(4) was a residual from a previous example. The use of 1.0e-9 instead of 0.0 was to avoid the risk of divisions by zero. Now the figure shows a better change at t=1000:

Thanks