From 1e6c9379857e4fffbb48b2ff7a6bee0fa0a1100d Mon Sep 17 00:00:00 2001
From: Hu Zhao <zhao@mbd.rwth-aachen.de>
Date: Fri, 10 Mar 2023 14:52:19 +0100
Subject: [PATCH] docs: add result plots for mpm example

---
 .../simulator/plot_mass_point_model.py        | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/docs/examples/simulator/plot_mass_point_model.py b/docs/examples/simulator/plot_mass_point_model.py
index bd61593..0b942fe 100644
--- a/docs/examples/simulator/plot_mass_point_model.py
+++ b/docs/examples/simulator/plot_mass_point_model.py
@@ -104,3 +104,25 @@ import warnings
 warnings.filterwarnings("ignore")
 output = mpm.run(elevation=elevation, coulomb_friction=mu, turbulent_friction=xi, x0=x0, y0=y0)
 
+# %% md
+# The simulation returns time history of the mass point's location and velocity.
+# Following plots show the simulation results.
+
+fig, ax = plt.subplots(3, 1, figsize=(10,6))
+
+ax[0].set_xlabel('time (s)')
+ax[0].set_ylabel('x')
+ax[0].set_title("x-t plot")
+ax[0].plot(output[:,0], output[:,1])
+
+ax[1].set_xlabel('time (s)')
+ax[1].set_ylabel('velocity')
+ax[1].set_title("v-t plot")
+ax[1].plot(output[:,0], output[:,5])
+
+ax[2].set_xlabel('x')
+ax[2].set_ylabel('velocity')
+ax[2].set_title("x-v plot")
+ax[2].plot(output[:,1], output[:,5])
+
+plt.tight_layout()
-- 
GitLab