ODEINT 求解常微分方程(3)

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,dydt]
return dzdt # initial condition
z0 = [0,0] # time points
t = np.linspace(0,5) # solve ODE
z = odeint(model,z0,t) # plot results
plt.plot(t,z[:,0],'b-',label=r'$\frac{dx}{dt}=3 \; \exp(-t)$')
plt.plot(t,z[:,1],'r--',label=r'$\frac{dy}{dt}=-y+3$')
plt.ylabel('response')
plt.xlabel('time')
plt.legend(loc='best')
plt.show()

ODEINT 求解常微分方程(3)的更多相关文章
- ODEINT 求解常微分方程(4)
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # function tha ...
- ODEINT 求解常微分方程(2)
import numpy as np from scipy.integrate import odeint import matplotlib.pyplot as plt # function tha ...
- ODEINT 求解常微分方程(1)
An example of using ODEINT is with the following differential equation with parameter k=0.3, the ini ...
- MATLAB求解常微分方程:ode45函数与dsolve函数
ode45函数无法求出解析解,dsolve可以求出解析解(若有),但是速度较慢. 1. ode45函数 ①求一阶常微分方程的初值问题 [t,y] = ode45(@(t,y)y-2*t/y, ...
- 欧拉法求解常微分方程(c++)
#include<iostream> #include<iomanip> using namespace std; int main() { double x, y, h; ...
- 改进欧拉公式求解常微分方程(c++)
#include<iostream> #include<iomanip> using namespace std; int main() { double x,y,h,temp ...
- 梯形法求解常微分方程(c++)
#include<iostream> #include<iomanip> using namespace std; int main() { double x,y,yn,h,t ...
- 后退欧拉法求解常微分方程(c++)
#include<iostream> #include<iomanip> using namespace std; int main() { double x,y,yn,h,t ...
- 欧拉法求解常微分方程(c++)【转载】
摘自<c++和面向对象数值计算>,代码简洁明快,采用类进行封装实现代码,增强代码的重用性,通过继承可实现代码的重用,采用函数指针,通用性增强,在函数改变时只需要单独改变函数部分的代码,无需 ...
随机推荐
- Redux:pre
If you aren't familiar with state management libraries like Redux or MobX, don't use context. For ma ...
- Angular的面试题
1.Aangular中组件之间通信的方式 答案:Props down 1.调用子组件,通过自定义属性传值 2.子组件内部通过Input来接收属性的值 Events up 1.在父组件中定义一个有参数 ...
- MYSQL mysql.user表中权限对应的解释
命令标识 授权表中对应的列 说明 CREATE Create_priv 创建数据库.表或索引 CREATE TEMPORARY TABLES Create_tmp_table_priv 创建临时数据表 ...
- 基于SpringCloud分布式架构
基于SpringCloud分布式架构 为什么要使用分布式架构 Spring Cloud 专注于提供良好的开箱即用经验的典型用例和可扩展性机制覆盖 分布式/版本化配置 服务注册和发现 路由 Servic ...
- 如何在手机上预览本地h5页面
很简洁的一个方法: 1.安装nodeJS环境 2.在当前所在项目文件夹下输入命令: npm install anywhere -g3.输入命令: anywhere,即可在浏览器以本机ip地址为域名,自 ...
- ShoneSharp语言(S#)软件更新13.7版
ShoneSharp语言(S#)编辑解析运行器 软件更新13.7版 作者:Shone 近期在写博客过程中对S#进行增强,把语法规则更新到2.0版,并同步更新软件到ShoneSharp.13.7.exe ...
- WordPress批量更换域名
UPDATE wp_options SET option_value = replace( option_value, 'http://www.old.com', 'http://www.new.co ...
- 通用css 常用
复选框自定义样式input[type="checkbox"] { position: relative; width: 0.75rem; height: 0.75rem; back ...
- IO字节流与字符流的操作
字节流: FileInputStream读取,FileOutputStream输出 字节流使用数组缓冲区复制文件,最后得出所使用的时间 public class work2 { publ ...
- Java 对象的继承,抽象类,接口
子父级继承 关键字 extends 首先创建一个父类 class Fu { String name; int a=1; public void word() { System.out.println( ...