function []=Mixed_Games(W,r) % % Mixed_Games(W, range) % where W is a 2x2 matrix of the payoff to the two pure strategies. % range is the range of strategy values to consider % if nargin<2 r=[0:0.01:1]; if nargin<1 W=[1 0; 2 -1]; % hawk-dove model end end Invades=zeros(length(r)+1); for p=1:length(r) P=[r(p); 1-r(p)]; PTWP=(P'*W)*P; for q=1:length(r) Q=[r(q); 1-r(q)]; QTWP=(Q'*W)*P; if QTWP>PTWP Invades(p,q)=1; end if QTWP