Dynamic System Simulation Exercise
This exercise is to simulation a second order Mass-Spring-Damper system in python, using both the continuous and discrete solutions.
The system dynamics can be expressed as:

1. Write a python script to simulate the system shown above in continuous-time using First Order Euler Integration.
Assume the system properties (m = 1, b = 1, k = 10)
Let the system be a unit step force response (f=1) with the initial condition x = 0 m, v = 0 m/s.
Simulate the System for 10 seconds with a time step DT of 0.01 seconds.
The system response should look like this:

2. Write a python script to simulate the system shown above in discrete-time using the Matrix Exponential Discretisation method for a timestep size of 0.1 seconds.
Assume the system properties (m = 1, b = 1, k = 10)
Let the system be a unit step force response (f=1) with the initial condition x = 0 m, v = 0 m/s.
Simulate the System for 10 seconds.
(Hint: You can use "from scipy.linalg import expm" and then "E = expm(Y)" to calculate the matrix exponential for matrix Y)
The system response should look the same as before.
3. Play around with the time step parameters and see how the response changes. See how the size of the step dramatically makes a difference to the continuous time system accuracy. Also see how it does not affect the discrete time accuracy (as the matrix exponential is used)
The answers for both the continuous and discrete simulations are available in the additional resources.