01输入常微分方程组
第一步,输入演化博弈中的常微分方程组。
其中:
X(1)为演化博弈中一方的决策概率X
X(2)为演化博弈中另一方的决策概率Y
按照函数名保存为.m的文件,例如案例中保存为”di”的文件。
The first step is to input the ordinary differential equations in the evolutionary game.
among them:
X(1) is the decision probability of one party in the evolutionary game X
X(2) is the decision probability Y of the other party in the evolutionary game
Save as a .m file according to the function name, such as the file saved as "di" in the example.
02输入画图主程序
第一个图:博弈双方策略的演化
对上述程序的解释:
1.ODE45函数:求解微分方程组的数值解
[T,Y]=ode45('differential',[0 5],[i j])
'differential':求解的函数名
[0 5]:T时间的区间
[i j]:初始值向量
2.Grid on :显示坐标轴网格线
3.y(:,1)中逗号前是行,逗号后是列,冒号表示从几到几。所以y(:,1)表示第一列的所有元素
y(:,1)相当于dx/dt
y(:,2)相当于dy/dt
4.保存该程序,再运行
Explanation of the above procedure:
1. ODE45 function: solve numerical solutions of differential equations
[T,Y]=ode45('differential',[0 5],[i j])
'differential': the name of the function to be solved
[0 5]: T time interval
[i j]: Initial value vector
2.Grid on: display the grid lines of the coordinate axis
3. In y(:,1), before the comma is the row, after the comma is the column, and the colon indicates the number from the number to the number. So y(:,1) means all elements in the first column
y(:,1) is equivalent to dx/dt
y (:, 2) is equivalent to dy/dt
4.Save the program and run
画出的演化图形:
第二个图:微分方程为dx/dt的策略方的演化过程
画出的图形:
第三个图:微分方程为dy/dt的策略方的演化过程
画出的图形:
参考资料:百度百科、谷歌翻译
本文由LearningYard学苑原创,如有侵权,请联系删除。