simulation and plot