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++和面向对象数值计算>,代码简洁明快,采用类进行封装实现代码,增强代码的重用性,通过继承可实现代码的重用,采用函数指针,通用性增强,在函数改变时只需要单独改变函数部分的代码,无需 ...
随机推荐
- Python--WebDriverWait+expected_conditions的一个应用
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.s ...
- sqoop-介绍及安装
1.sqoop概述 sqoop是Apache旗下一款hadoop和关系数据库服务器之间传送数据的工具: 核心的功能: 导入,迁入(从关系型数据库-->hdfs hive hbase) 导出,迁出 ...
- WordPress获取某个分类关联的标签
我在WordPress后台某篇文章的编辑页面,给这篇文章选择了分类:WordPress,接着同时选择了标签:php.主题制作,这时分类(WordPress)就与标签(php.主题制作)建立了关联,利用 ...
- MySQL性能分析(Explain)
更多知识,请移步我的小破站:http://hellofriend.top 1. 概述 使用EXPLAIN关键字可以模拟优化器执行SQL查询语句,从而知道MySQL是如何处理你的SQL语句的.分析你的查 ...
- Android_四大组件之BroadcastReceiver
一.概述 BroadcastReceiver是广播接收器,接收来自 系统或应用发出的广播信息 并进行相应的逻辑处理. 自定义BroadcastReceiver只需继承android.content.B ...
- 关于String是值传递还是引用传递
public class Itv { static String ss = "kkkkkk"; static String ss1 = new String("kkkkk ...
- SSI PAYLOAD
<pre><!--#exec cmd="ls" --></pre><pre><!--#echo var="DATE_ ...
- 10 . Python之面向对象
面向对象编程--Object Oriented Programming,简称OOP,是一种程序设计思想.OOP把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数. 面向对象初识别 面向过程v ...
- 深入理解Mybatis(第一讲)——手写ORM框架(简易版Mybatis)
我们来自定义一个持久层框架,也就是Mybatis的简易版. 使用端的搭建 idea中新建maven工程IPersistence_test: 在resources目录下新建sqlMapConfig.xm ...
- Python--numpy中的tile()函数
首先是官方给的定以(我是用的VsCode,鼠标放置在tile上出现的),建议直接看后面的示例. def tile(A, reps) Construct an array by repeating ...