import numpy as np import matplotlib.pyplot as plt n = 1000 # number of timesteps T = 50 # time will vary from 0 to T with step delt ts = np.linspace(0,T,n+1) delt = T/n gamma = .05 # damping, 0 is no damping A = np.zeros((4,4)) B = np.zeros((4,2)) A[0,0] = 1 A[1,1] = 1 A[0,2] = (1-gamma*delt/2)*delt A[1,3] = (1-gamma*delt/2)*delt A[2,2] = 1 - gamma*delt A[3,3] = 1 - gamma*delt B[0,0] = delt**2/2 B[1,1] = delt**2/2 B[2,0] = delt B[3,1] = delt x_0 = np.array([10, -20, 30, -10]) K = 3 tk = np.array([ 300, 600, 1000])-1 wp = np.array([[100, 50, 150], [ 0, 50, 80], [ 0, 0, 0]]) pa = np.array([ 135, 60, 0]) # your code here