Description: 数值解法
例1 用改进的欧拉方法求一阶方程初值问题的
数值解
例2 数学摆的运动方程与近似方程数值解比较
例3 四阶龙格库塔公式求数值解
Matlab实现求数值解
例1 求初值问题y =x*sin(x)-y,y(0)=0的数值
解.先编辑一个定义方程的ODEF函数文件
ODEfun1.m.
例2 求方程组初值问题的数值解,按指定步长
0.05划分节点.
例3 按指定的精度求高阶方程初值问题的数值解.-Numerical Solution of the law a method of using the improved Euler' s equation of order to a first-order initial value problem of the numerical solution of cases of two mathematical pendulum equations of motion compared with the approximate numerical solutions of equations of three cases of fourth-order Runge-Kutta numerical solution of the formula Matlab order to achieve the numerical solution of demand cases seeking an initial value problem y ' = x* sin (x)-y, y (0) = 0 the numerical solution. first, the definition of an equation editor ODEF function file ODEfun1.m. cases of two demand equations initial value problem of numerical solution, according to the specified division of the node step 0.05. Example 3 according to the specified precision of seeking higher-order equation of the numerical solution of initial value problem. Platform: |
Size: 4096 |
Author:率一 |
Hits:
Description: 1.用四阶 Runge-Kutta 法求数值积分的函数为 RK4
2.此函数的入口参数为:系统维数 dimension,仿真时间 tspan 。
3.tspan 的格式为 [a:h:b] . 其中 a 表示起始时间,h 表示步长,b 表示终止时间。
4.仿真模型的状态方程、输出方程的系数矩阵以及系统初值均存放于文件 input information.txt 中。
5.仿真结果存放于文件 result.txt 中。
6.运行举例:
将 M 文件 RK4.m 和 input information.txt 均存放于 Matlab 的当前工作目录下,然后在 Command Window 中输入以下命令:
dimension=3
tspan=[0:0.01:2]
RK4(dimension,tspan)
回车后,打开 Matlab 的当前工作目录文件夹,找到文件 result.txt ,即可看到仿真结果。-1. Numerical Integration function with fourth-order Runge-Kutta method RK4 2. Inlet parameters of this function: the system dimension dimension, the simulation time tspan. 3.tspan Formats for [a: h: b], wherein A represents a start time, h is the step length, b indicates the termination time. The equation of state of the simulation model, the coefficient matrix of the equation as well as the system initial value of the output is stored in the file input information.txt. The 5. Simulation results are stored in a file result.txt. Running example: the the M file RK4.m and input information.txt of are placed in Matlab current working directory, then enter the following command in the Command Window: dimension = 3 tspan = [0:0.01:2] RK4 (dimension, tspan) Enter, open Matlab' s current working directory folder find the file result.txt, you can see the simulation results. Platform: |
Size: 1024 |
Author:闫兆敏 |
Hits:
Description: 一次数值分析作业,包括多种算法的m语言文件,包括欧拉、龙格库塔等-A numerical analysis operations, including a variety of algorithms m language documents, including Euler, Runge-Kutta, etc. Platform: |
Size: 5120 |
Author:王娜 |
Hits:
Description: 这是用四阶龙格库塔法计算半导体激光器速率方程的工程,源代码用C语言书写,开发平台为VC6.0。程序输出数据被写入文件SLdata.txt中,其中第一列为仿真时间,第二列为载流子浓度,第三列为光子密度。为了方便更多相关开发者调试,还提供了一个matlab源文件test.m。test.m用于将计算数据在matlab中用曲线显示。-This is project developed by Visual C++ 6.0 software platform, which uses the 4th order Runge Kutta method to solve the rate equations in semiconductor lasers. The computational results is placed in the file named by SLdata.txt , in which the first colomn stand for the simulation time, the second represents the carrier density at corresponding time, and the third colomn is the photon density. For convinence, another matlab source code file is also presented, which can be used to display the simulation data by some plots within Matlab environment. Platform: |
Size: 1103872 |
Author:王刚 |
Hits: