So here is my code so far:
M=1000*ones(100,1); %100 agents with 1000$ initially.
T=input('enter a value for T:'); %the number of times that 2 agents are randomly picked and are allowed to interact.
for i=1:1:T %loop from i=1 to i=T.
x=randi([1 100],1); %agent 1 picked at step i.
y=randi([1 100],1); %agent 2 picked at step i.
R=rand; %generates a random number between 0 and 1
y=randi([1 100],1); %in case picking twice the same agent
M(x)=R.*(P+Q); %such reassignment of money ensures no dept after transaction.
Mf=sum(M,1); % Mf = total amount of money (~=100,000$)
fprintf('Total amount of money:\n%5.0f\t%5.0f\n',Mf);
E=sum(D); % E = total amount of money among the 20 richest agents.
fprintf('Amount of money among the 20 richest agents:\n%5.0f\t%5.0f\n',E);
How can i plot the distribution of money after T pickings ?
I'd guess a gaussian dist, what are the command in this case?
where should I place it within the code?