I am dealing with the Pontryagin-Maximum-Principle and i calculated the so called reachable set $R_T$.
I am using the following code that plots the reachable set for a certian endtime $T$:
x0=100
y0=0
T=5
tau=0:0.0001:T
alphamax=(x0/(2*exp(T)-1))^(0.5)
alpha=0:0.0001:alphamax
x1=x0*exp(T-tau)
y1=tau*x0^(0.5)
plot(x1,y1,'r','LineWidth',2)
hold on;
x2=x0*exp(T)+(alpha.^2).*(exp(T)-exp(2*T))
y2=alpha.*(exp(T)-1)
plot(x2,y2,'b','LineWidth',2)
x3=(exp(2*tau)*x0)./(2*exp(tau)-1)
y3=(((x0)^(0.5))*exp(tau).*(T-tau+1-exp(-tau)))./((2*exp(tau)-1).^(0.5))
plot(x3,y3,'g','LineWidth',2)
The boundary of the reachable set are paremetrisied curves. See the below plots for $T=1$ and $T=5$.
How can i create a animation that shows $T\mapsto R_T$ for $T\in[0,3]$ for example?
I tried do compute a for-loop but did not achieved the desired solution. A avi.file would be very nice for presentation.
$T=1$">
$T=5$">
Partial answer (because I don't remember the details):
Many years ago, I made an animation of a coherent state quantum harmonic oscillator in MATLAB. I don't remember the exact commands, and the script is on a computer I unfortunately no longer have access to (I had not yet heard about Github).
What I did was to draw every frame in a
for-loop, and save as a .png, then use an external software to stitch it together to an animated .gif. I have no idea what caused the artifacting, though. I tried to fix it back then but couldn't.