Plot script reads from STDIN and specified file.

parent 550db093
...@@ -46,7 +46,7 @@ int f_lottka_volt(double t, double *y, double *dy, void *params) { ...@@ -46,7 +46,7 @@ int f_lottka_volt(double t, double *y, double *dy, void *params) {
// x' = -a * x + c * d * x * y // x' = -a * x + c * d * x * y
dy[0] = - PARAM(0) * y[0] + PARAM(2) * PARAM(3) * y[0] * y[1]; dy[0] = - PARAM(0) * y[0] + PARAM(2) * PARAM(3) * y[0] * y[1];
// y' = b * y - d * x * y // y' = b * y - d * x * y
dy[1] = - PARAM(1) * y[1] - PARAM(3) * y[0] * y[1]; dy[1] = PARAM(1) * y[1] - PARAM(3) * y[0] * y[1];
return 0; return 0;
} }
......
#!/usr/bin/env python #!/usr/bin/env python
from sys import argv, exit from sys import argv, exit, stdin
from pylab import figure, clf, plot, show, savefig from pylab import figure, clf, plot, show, savefig
if len(argv) < 2: try:
print 'Usage: %s DATA_FILE [ TARGET_FILE ]' % argv[0] f = open(argv[1], 'r')
exit() except IndexError:
f = open(argv[1], 'r') f = stdin
lines = f.readlines() lines = f.readlines()
f.close() f.close()
x = [] x = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment