Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#陰解法
#参考:三浦岳、発生の数理、京都大学学術出版会、2015、4.5
#julia v0.6
using Plots
gr()
A=circshift(eye(10),(0,1))+circshift(eye(10),(0,-1))-2*eye(10)
dt=0.05
initialDistribution=[0,0,0,1,1,1,0,0,0,0]
onestep(v)=(inv(eye(10)-dt*A))*v
u=initialDistribution
anim = @animate for g=0:100
plot(u,
#xticks=0:1:20,
ylim=(0.0,1.5),
yticks=0.0:0.1:1.5,
seriestype=:bar,
title="gen = $g")
u=onestep(u)
end
@time gif(anim, "tmp/diff04.gif", fps = 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment