一起读文献——演化博弈论文01

图片1代码

function dxdt = taihu(t, x, f_m,psi, c_prime, xi, pi, pi_prime, f_p1, f_prime)

    dxdt = zeros(2, 1); % 初始化导数向量

    % 计算状态变量的导数

    dxdt(1) = x(1) * (1 – x(1)) * (((x(2)*(psi-1)-psi)*f_m)-c_prime+(1-x(2))*xi*(pi_prime-pi)); % 第一个状态变量的导数

    dxdt(2) = x(2) * (1 – x(2)) * ((x(1)-1)*f_p1-x(1)*(1-xi)*(pi_prime-pi)+x(1)*psi*f_prime);

end

% 定义时间范围

tspan = [0, 20];

% 定义初始状态向量

x0_1 = [0.2, 0.8];

x0_2 = [0.4, 0.6]; 

x0_3 = [0.6, 0.4]; 

x0_4 = [0.8, 0.2]; 

% 定义参数

psi = 0.5;

f_p1 = 30;

c_prime = 100;

xi = 0.9;

f_m = 100;

f_prime = 40;

pi = 1189;

pi_prime = 1437;

% 求解微分方程

[t1, x1] = ode45(@(t, x) taihu(t, x, f_m,psi, c_prime, xi, pi, pi_prime, f_p1, f_prime), tspan, x0_1);

[t2, x2] = ode45(@(t, x) taihu(t, x, f_m,psi, c_prime, xi, pi, pi_prime, f_p1, f_prime), tspan, x0_2);

[t3, x3] = ode45(@(t, x) taihu(t, x, f_m,psi, c_prime, xi, pi, pi_prime, f_p1, f_prime), tspan, x0_3);

[t4, x4] = ode45(@(t, x) taihu(t, x, f_m,psi, c_prime, xi, pi, pi_prime, f_p1, f_prime), tspan, x0_4);

figure

plot(x1(:,1), x1(:,2), ‘ko-‘, ‘MarkerFaceColor’, ‘#D95319’, ‘MarkerSize’, 8, ‘MarkerEdgeColor’, ‘k’)

hold on;

plot(x2(:,1), x2(:,2), ‘kv-‘, ‘MarkerFaceColor’, ‘#FCA03D’, ‘MarkerSize’, 8, ‘MarkerEdgeColor’, ‘k’)

plot(x3(:,1), x3(:,2), ‘kd-‘, ‘MarkerFaceColor’, ‘#3DD2FC’, ‘MarkerSize’, 8, ‘MarkerEdgeColor’, ‘k’)

plot(x4(:,1), x4(:,2), ‘ks-‘, ‘MarkerFaceColor’, ‘#00552E’, ‘MarkerSize’, 8, ‘MarkerEdgeColor’, ‘k’);

xlabel(‘x’);

ylabel(‘y’);

title(‘演化’);

legend(‘x0=[0.2, 0.8]’, ‘x0=[0.4, 0.6]’, ‘x0=[0.6, 0.4]’, ‘x0=[0.8,0.2]’);

xlim([0, 1]);

ylim([0, 1]);

图片14

% 定义时间范围

tspan = [0, 1.2];

% 定义初始状态向量

x0_1 = [0.5, 0.5];

% 定义参数

f_p1 = 30;

c_prime = 100;

xi = 0.9;

f_m = 100;

f_prime = 50;

pi = 1189.86;

pi_prime = 1437.28;

% 定义 psi_vl 的值

psi_vl = [0.05, 0.35, 0.65, 0.95];

% 定义每个 psi 对应的标记类型和颜色

marker_types = {‘o’, ‘^’, ‘d’, ‘s’};

marker_colors = {‘#D95319’, ‘#FCA03D’, ‘#3DD2FC’, ‘#00552E’};

figure;

hold on;

% 循环迭代每个 psi 值

for i = 1:length(psi_vl)

    % 当前的 psi 值

    psi = psi_vl(i);

    

    % 使用当前的 psi 值求解微分方程

    [t1, x1] = ode45(@(t, x) taihu(t, x, f_m, psi, c_prime, xi, pi, pi_prime, f_p1, f_prime), tspan ,x0_1);

    

    % 绘制结果,使用当前标记类型和颜色,并确保标记点是实心的

    plot(x1(:,1), x1(:,2), [‘-‘, marker_types{i}], ‘Color’, ‘k’, ‘MarkerSize’, 7, ‘MarkerFaceColor’, marker_colors{i}, ‘MarkerEdgeColor’, ‘k’);

    

end

hold off;

xlabel(‘x’);

ylabel(‘y’);

title(‘演化’);

legend(‘psi = 0.05’, ‘psi = 0.35’, ‘psi = 0.65’, ‘psi = 0.95’);

xlim([0, 1]);

ylim([0, 1]);

图片16

% 定义时间范围

tspan = [0, 20];

% 定义初始状态向量

x0_1 = [0.5, 0.5];

% 定义参数

psi=0.5;

f_p1 = 30;

c_prime = 100;

xi = 0.9;

f_m = 100;

f_prime = 50;

% 定义 psi_vl 的值

pi_vl = [1039.859375,1189.86,1339.859375,1489.859375];

pi_prim = [1249.7802734375,1437.28,1624.7802734375,1812.2802734375];

% 定义每个 psi 对应的标记类型和颜色

marker_types = {‘o’, ‘^’, ‘d’, ‘s’};

marker_colors = {‘#D95319’, ‘#FCA03D’, ‘#3DD2FC’, ‘#00552E’};

figure;

hold on;

% 循环迭代每个 psi 值

for i = 1:length(pi_vl)

    % 当前的 psi 值

    pi = pi_vl(i);

    pi_prime=pi_prim(i);

    % 使用当前的 psi 值求解微分方程

    [t1, x1] = ode45(@(t, x) taihu(t, x, f_m, psi, c_prime, xi, pi, pi_prime, f_p1, f_prime), tspan ,x0_1);

    

    % 绘制结果,使用当前标记类型和颜色,并确保标记点是实心的

    plot(x1(:,1), x1(:,2),[‘-‘, marker_types{i}], ‘Color’, ‘k’, ‘MarkerSize’, 6, ‘MarkerFaceColor’, marker_colors{i}, ‘MarkerEdgeColor’, ‘k’);

    

end

hold off;

xlabel(‘x’);

ylabel(‘y’);

title(‘演化’);

legend(‘{\beta=0}’, ‘{\beta=20}’, ‘{\beta=40}’, ‘{\beta=60}’,’latex’);

xlim([0, 1]);

资源下载: