예제 #1
0

def s(u):
    return 2 * u


T = 10 * pi  # simulate for t in [0,T]
dt = 0.2
N = int(round(T / dt))
t = linspace(0, T, N + 1)
F = zeros(t.size)
I = 1
V = 0
m = 2
b = 0.2
u = solver_linear_damping(I, V, m, b, s, F, t)

from matplotlib.pyplot import *
plot(t, u)
savefig('tmp.pdf')  # save plot to PDF file
savefig('tmp.png')  # save plot to PNG file
show()
# End solver_linear_damping

import numpy as np
from numpy import sin, pi  # for nice math
from solver import solver


def F(t):
    # Sinusoidal bumpy road
예제 #2
0
 def solver_linear_damping_wrapper(I, V, m, b, s, F, t, damping='linear'):
     """Wrapper such that solver_linear_damping can be called as solver."""
     if callable(F):
         F = F(t)
     return solver_linear_damping(I, V, m, b, s, F, t), t
예제 #3
0
파일: session.py 프로젝트: hplgit/bumpy
from solver import solver_linear_damping
from numpy import *

def s(u):
    return 2*u

T = 10*pi      # simulate for t in [0,T]
dt = 0.2
N = int(round(T/dt))
t = linspace(0, T, N+1)
F = zeros(t.size)
I = 1; V = 0
m = 2; b = 0.2
u = solver_linear_damping(I, V, m, b, s, F, t)

from matplotlib.pyplot import *
plot(t, u)
savefig('tmp.pdf')   # save plot to PDF file
savefig('tmp.png')   # save plot to PNG file
show()
# End solver_linear_damping

import numpy as np
from numpy import sin, pi  # for nice math
from solver import solver

def F(t):
    # Sinusoidal bumpy road
    return A*sin(pi*t)

def s(u):
예제 #4
0
파일: test_bumpy.py 프로젝트: hplgit/bumpy
 def solver_linear_damping_wrapper(
     I, V, m, b, s, F, t, damping='linear'):
     """Wrapper such that solver_linear_damping can be called as solver."""
     if callable(F):
         F = F(t)
     return solver_linear_damping(I, V, m, b, s, F, t), t