Mercurial > repos > public > sbplib
annotate +anim/func.m @ 500:83734c26b8e3 feature/quantumTriangles
Small changes
| author | Ylva Rydin <ylva.rydin@telia.com> |
|---|---|
| date | Thu, 20 Apr 2017 07:55:09 +0200 |
| parents | 7f54cef985de |
| children |
| rev | line source |
|---|---|
| 0 | 1 % Animates a function F(x,t) for x in lim from t to tend |
| 228 | 2 function func(F, xrange, yrange, T, timeMod) |
| 3 default_arg('timeMod', 1); | |
| 0 | 4 x = linspace(xrange(1),xrange(2), 200); |
| 5 | |
| 6 fig_handle = figure; | |
| 228 | 7 plot_handle = plot(x,F(x,T(1))); |
| 0 | 8 xlim(xrange) |
| 9 ylim(yrange) | |
| 10 axis_handle = gca; | |
| 11 | |
| 12 | |
| 13 function t = G(t) | |
| 14 set(plot_handle,'YData',F(x,t)) | |
| 15 title(axis_handle,sprintf('T=%.3f',t)); | |
| 16 drawnow | |
| 17 end | |
| 18 | |
| 228 | 19 anim.animate(@G, T(1), T(2), timeMod); |
| 0 | 20 end |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 |
