 # Time Integration Method

Hi
I was trying to write a program in python to numerically evaluate the dynamic response of a structure (displacement and velocity response) in a giving time interval. As i am new to python, firstly I wrote the program with MATLAB than I converted to python by identification. but I didn’t get same outputs. I was wondering if someone could examine my coding that I joined below and get suggestions to fix my errors. Thank you in advance.

MATLAB CODE

u(1)=0;
v(1)=0;
tt=.50;
n=100;
n1=n+1;
dt=tt/n;
td=.05;
jk=td/dt;
for m=1:n1
p(m)=0.0;
end
t=-dt;

for m=1:jk+1
t=t+dt;
p(m)=445500*(td-t)/td;
end
a=0.99888;
b=0.0049;
c=1.8210^(-10);
d=9.1305
10^(-11);
bd=0.974;
cd=5.419610^(-8);
dd=5.467
10^(-8);

for m=2:n1
u(m)=au(m-1)+bv(m-1)+cp(m-1)+dp(m);
end
for m = 1:n1
s(m)=(m-1)*dt;
end
disp(u)
disp(v)

PYTHON CODE

import numpy as np
import matplotlib.pyplot as plt
import math
import scipy

f0 = 445500
a = 0.99888
b = 0.0049
c = 1.8210**(-10)
d = 9.1305
10**(-11)
bd = 0.974;
cd = 5.419610**(-8)
dd = 5.467
10**(-8)
td = 0.05
dt = 0.005
dti = np.arange(0, 0.505, 0.005)
t = dti
l = len(dti)
for i in range (l):
p = 0
p1 = 0
u = 0
v = 0
for i in range (l):
p1 = f0 * (1 - (t + 0.005) / td)
p = f0 *(1 - t / td)
u = a * u + b * v + c *p + d * p1
v = ad * u + bd * v + cd *p + dd * p1
break

print(u)
print(v)