[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Bart Vandewoestyne |
Date: |
Tue, 08 Dec 2009 09:56:53 +0000 |
Hello list,
For an assignment, my students are using finite differences to compute a
solution of the 1D wave equation. Because I only want them to bother with the
numerics, not with practical plotting stuff, I've made available the following
script which they can use to animate their solution:
--------------------------- begin script ---------------------------
function generate_movie1d(f, g, Nx, t_max, L, c, lambda)
[u dt] = wave1d(f, g, Nx, t_max, L, c, lambda);
mymax = max(max(u));
mymin = min(min(u));
x = linspace(0, L, Nx+1);
for i=1:size(u,2)
plot(x, u(:,i), '*r')
axis([0 L mymin mymax])
title(sprintf('Solution of the one-dimensional wave equation at t = %f',
(i-1)*dt))
drawnow
hold off
end
------------------------------ end script ----------------------------------
This all worked fine on my (fast) Ubuntu desktop PC, but one of my students
(working on a quite fast Windows Vista laptop) reported 'flickering'
graphics... the updating of the animation is very bad and makes the animation
very unfluent. I assume this is not due to a slow computer (his laptop is
quite fast), but rather due to the fact that I use the drawnow command to
update the graphics... maybe also due to the fact that he works on Windows
Vista? Unfortunately, I don't know how I would have to change my code so that
the updating is more 'fluent'.
Can anybody help me out here, so that I can give my students a script that also
gives fluent animations, even on Windows? What is the general technique to do
this? Am i doing it the right way?
Kind regards,
Bart
- [no subject],
Bart Vandewoestyne <=
- Slow plotting on Windows [was: ], Søren Hauberg, 2009/12/08
- Re:, macy, 2009/12/08
- Re:, Leo Butler, 2009/12/08
- Re:, Francesco Potortì, 2009/12/14
- Re:, Francesco Potortì, 2009/12/14