3434import matplotlib .pyplot as plt
3535import numpy as np
3636import math
37+ plt .rcParams ['mathtext.fontset' ]= 'cm'
3738
3839"""The functions in this file can be used to plot data of any kind of model"""
3940
4041
41- def plot_force_predeictions (stacked_force_vec , stacked_force_vec_pred , timestamp_array ):
42+ def plot_force_predictions (stacked_force_vec , stacked_force_vec_pred , timestamp_array ):
4243 """
4344 Input:
4445 stacked_force_vec: numpy array of shape (3*n,1) containing stacked accelerations [a_x_1, a_y_1, a_z_1, a_x_2, ...]^T in body frame
@@ -62,15 +63,15 @@ def plot_force_predeictions(stacked_force_vec, stacked_force_vec_pred, timestamp
6263 ax3 .plot (timestamp_array , acc_mat [:, 2 ], label = 'measurement' )
6364 ax3 .plot (timestamp_array , acc_mat_pred [:, 2 ], label = 'prediction' )
6465
65- ax1 .set_ylabel ('x ' )
66- ax2 .set_ylabel ('y ' )
67- ax3 .set_ylabel ('z ' )
66+ ax1 .set_ylabel ('$x$ ' )
67+ ax2 .set_ylabel ('$y$ ' )
68+ ax3 .set_ylabel ('$z$ ' )
6869 ax3 .set_xlabel ('time [s]' )
6970 plt .legend ()
7071 return
7172
7273
73- def plot_moment_predeictions (stacked_moment_vec , stacked_moment_vec_pred , timestamp_array ):
74+ def plot_moment_predictions (stacked_moment_vec , stacked_moment_vec_pred , timestamp_array ):
7475 """
7576 Input:
7677 stacked_moment_vec: numpy array of shape (3*n,1) containing stacked angular accelerations [w_x_1, w_y_1, w_z_1, w_x_2, ...]^T in body frame
@@ -94,9 +95,9 @@ def plot_moment_predeictions(stacked_moment_vec, stacked_moment_vec_pred, timest
9495 ax3 .plot (timestamp_array , acc_mat [:, 2 ], label = 'measurement' )
9596 ax3 .plot (timestamp_array , acc_mat_pred [:, 2 ], label = 'prediction' )
9697
97- ax1 .set_ylabel ('x ' )
98- ax2 .set_ylabel ('y ' )
99- ax3 .set_ylabel ('z ' )
98+ ax1 .set_ylabel ('$x$ ' )
99+ ax2 .set_ylabel ('$y$ ' )
100+ ax3 .set_ylabel ('$z$ ' )
100101 ax3 .set_xlabel ('time [s]' )
101102 plt .legend ()
102103 return
@@ -119,10 +120,10 @@ def plot_airspeed_and_AoA(airspeed_mat, timestamp_array):
119120 ax2 .plot (timestamp_array , airspeed_mat [:, 1 ], label = 'measurement' )
120121 ax3 .plot (timestamp_array , airspeed_mat [:, 2 ], label = 'measurement' )
121122 ax4 .plot (timestamp_array , airspeed_mat [:, 3 ], label = 'measurement' )
122- ax1 .set_title ('airspeed in x direction of body frame [m/s^2]' )
123- ax2 .set_title ('airspeed in y direction of body frame [m/s^2]' )
124- ax3 .set_title ('airspeed in z direction of body frame [m/s^2]' )
125- ax4 .set_title ("Aoa in body frame [radiants ]" )
123+ ax1 .set_title (r'Airspeed in body-$x$ [m/s^2]' )
124+ ax2 .set_title (r'Airspeed in body-$y$ [m/s^2]' )
125+ ax3 .set_title (r'Airspeed in body-$z$ [m/s^2]' )
126+ ax4 .set_title ("AoA in body frame [radians ]" )
126127 plt .legend ()
127128 return
128129
0 commit comments