随笔分类 - Python
Python
摘要:import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # function that returns dz/dt def model(z,t): dxdt = 3.0 * np.exp(-t) dydt = -z[1] + 3 dzdt = [dxdt...
阅读全文
摘要:import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # function that returns dy/dt def model(y,t): # u steps from 0 to 2 at t=10 if t<10.0: u = 0 ...
阅读全文
摘要:An example of using ODEINT is with the following differential equation with parameter k=0.3, the initial condition y0=5 and the following differential
阅读全文
摘要:class parent(object): def implicit(self): print("Parent implicit()") def override(self): print("Parent override()") def altered(self): print("Parent a
阅读全文
摘要:class Song(): def __init__(self,lyrics): self.lyrics=lyrics def sing_a_song(self): for line in self.lyrics: print(line) happy=Song(["Happy birthday to you", "Happy...
阅读全文
摘要:x1=x0+px2−1=x1+x0x2=x21 p=1.2 还可以做一些修改 1 from gekko import GEKKO 2 m=GEKKO() 3 p=m.Param(1.2) 4 x=m.Array(m.Var,3) 5 eq0 = x[1]==x[0]+p 6 eq1 = x[2]-1
阅读全文
摘要:import numpy as np import matplotlib.pyplot as plt from scipy.fftpack import fft fs=100 #采样频率 N=128 #数据点数 n=np.arange(0,N) t=n/fs #时间序列 pi=3.14 x=0.5*np.sin(2*pi*15*t)+2*np.sin(2*pi*40*t) y=...
阅读全文

浙公网安备 33010602011771号