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++和面向对象数值计算>,代码简洁明快,采用类进行封装实现代码,增强代码的重用性,通过继承可实现代码的重用,采用函数指针,通用性增强,在函数改变时只需要单独改变函数部分的代码,无需 ...
随机推荐
- P1251 餐巾计划问题 网络流
P1251 餐巾计划问题 #include <bits/stdc++.h> using namespace std; typedef long long ll; , inf = 0x3f3 ...
- linux常用命令---文件权限操作
文件权限
- ORM多表增删改查
一 创建多表 在models.py里创建4张表:Author(作者).AuthorDetail(作者详细信息).Publish(出版社).Book(书) 四张表关系为: (1)首先创建一对一关系.On ...
- UVA10480 Sabotage
题目链接:https://cn.vjudge.net/problem/UVA-10480 知识点: 最小割 题目大意: 求最小割并打印出最小割必须割掉的边. 解题思路: 在跑完 \(sap\) 后的残 ...
- docker的file内容解释
关键字---重点啊) FROM 基础镜像,当前新镜像是基于哪个镜像的 MAINTAINER 镜像维护者的姓名和邮箱地址 RUN 容器构建时需要运行的命令 EXPOSE 当前容器对外暴露的端口 WO ...
- 调用 start_kernel
步骤 1 关闭中断.进入 SVC 模式 ENTRY(stext) THUMB( adr r9, BSYM(1f) ) @ Kernel is always entered in ARM. THUMB( ...
- Linux目录遍历opendir()
头文件:#include<dirent.h> DIR *opendir(const char *dirname); 打开目录 struct dirent *readdir(DIR *dir ...
- 使用PRTG和panabit结合定位网络阻塞的来源
一.背景 在网络管理工作中,有时会出现网络阻塞,需要定位阻塞来源以采取措施解决问题.二.以一个网络阻塞案例说明定位方法 案例:某企业日常使用多条网络线路,某一段时间发现某条线路传输速率下降,对 ...
- appnium(一)简介
一.appium简介 1,appium是开源的移动端自动化测试框架: 2,appium可以测试原生的.混合的.以及移动端的web项目: 3,appium可以测试ios,android应用(当然了,还有 ...
- ASP.NET Core 依赖注入最佳实践与技巧
ASP.NET Core 依赖注入最佳实践与技巧 原文地址:https://medium.com/volosoft/asp-net-core-dependency-injection-best-pra ...