# plotting the solutions of system of differential equations [duplicate]

The following code include the system of differential equations:

    Derivative[1][x][t] == -10^12 x[t] - y[t]+2*10^-10,
Derivative[1][y][t] == x[t] - 10^12 y[t] + z[t]-2,
Derivative[1][z][t] == - 2*y[t],
x[0] == y[0] == 0, z[0] == 1


I want to plot z[t] vs t. But, unfortunately Mathematics cannot plot it. How can I plot it?

-

## marked as duplicate by Artes, m_goldberg, Sjoerd C. de Vries, István Zachar, Pinguin DirkSep 9 '13 at 10:45

Dig into the online documentation a bit, e.g. at DSolve and NDSolve. There are plenty of examples. – István Zachar Sep 9 '13 at 8:28

Ok Farhad, I think I have what you wanted. First you have to actually solve the system. Please let me know if I did not interperet what you intended in my modification here. The next thing you do is plot the results. This will certainly get you rolling:

 soln = NDSolve[{
x'[t] == -10^(12) x[t] - y[t] + 2*10^(-10),
y'[t] == x[t] - 10^(12) y[t] + z[t] - 2,
z'[t] == -2*y[t],
x[0] == y[0] == 0, z[0] == 1}, {x, y, z}, {t, 0, 50},
MaxSteps -> Infinity];


 Plot[Evaluate[z[t] /. soln], {t, 0, 50}, PlotRange->{0,2}]