01輸入常微分方程組
第一步,輸入演化博弈中的常微分方程組。
其中:
X(1)為演化博弈中一方的決策機率X
X(2)為演化博弈中另一方的決策機率Y
按照函式名儲存為.m的檔案,例如案例中儲存為”differential.m”的檔案。
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 "differential.m" 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的策略方的演化過程
畫出的圖形:
參考資料:百度百科、谷歌翻譯