Question: Help : How to animate plot

Hello,

I've problem to make the plot to animate [plot]. Please help. Thanks. Below are the commands

>restart: with(plots):
>N[0]:= 10 ;  K:= 1000 ; # initial condition and `carrying capacity`
 title2:=`N(t) vs t when r= `: # title blanks for plots
 sample_r:= [0.4, 0.7, 1.0, 1.3, 1.6, 1.9];
 P_frames:= NULL:

>for r in sample_r  do
 plot_list:= [0, N[0]]: 
 pairs:= NULL:  # initialize the plots

>for t from 0 to 30 do
 N[t+1]:= N[t] + ( r / k ) * N[t] * ( K - N[t] ):  # logistic model
 N[t+1]:= N[t] * exp(r * (1 - N[t] / K)):
 pairs:= pairs,[N[t+1], N[t]]:
 plot_list:= plot_list, [t+1, N[t+1]]:
 od:

>P[r]:= plot([ plot_list ], style=line, color=plum, title=cat(title2, convert(r,string))):
 P_frames:= P_frames,  P[r] :
 od:

>display([P_frames],  insequence=true);

 

Regards,

Sheby

 


Please Wait...