Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
0db05df5
Commit
0db05df5
authored
Apr 09, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plot script reads from STDIN and specified file.
parent
550db093
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
modsim/ass3/harm_osc.c
modsim/ass3/harm_osc.c
+1
-1
modsim/ass3/plot.py
modsim/ass3/plot.py
+5
-5
No files found.
modsim/ass3/harm_osc.c
View file @
0db05df5
...
@@ -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
;
}
}
...
...
modsim/ass3/plot.py
View file @
0db05df5
#!/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
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment