I want to save players' utilities @ Nash equilibrium.

Ok, the problem is about telecommunications.

Specifically, it is efficient power control via pricing in wireless data networks.

There is a utility function (u=L*R.*f./(M.*pj)-c.*pj)

f is the efficiency function (f=(1-2.*pe).^M)

pe is the Bit Error Rate

and g is the Signal to Interference Ratio

k is a constant equal to 7,75*10^(-3)

M is total number of bits per frame

L is number of information bits per frame

W is spread spectrum bandwidth

R is bit rate

s^2 is noise at the receiver

h=k./(d.^4) is simply the gain of the route

and pmax is the maximum powwer constraint for every player

d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00] is the list of distances that players have from the terminal

We try all power levels pj=0.001:0.00001:pmax for every player and compute signal, interference and then utility, trying to find the best response.

We also try all cost levels c=10^3:10^4:10^10^5 for every power level, for every player at every trial to find the best response via pricing, as the previous process does not results to an efficient equilibrium!

The general idea is to find the maximum utilities and save them.All I have to do now is the last part which is saving utilities at equilibrium and make a graph of the results!I know that you might still not have a clear picture, but I just tried to describe you the concept...

Any help is welcome and even a little bit of code that is not correct, just to give me an idea of how to do these things...Thanks in advance!

Here is my code:

close all;

clear all;

L=64;

R=10^4;

M=80;

W=10^6;

s2=5*10^(-15);

pmax=2;

k=0.097*10^(-3);

pj=0.001:0.00001:pmax;

d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00];

h=k./(d.^4);

ind=1;

ind2=1;

p(ind,:)=ones(1,9);

q=zeros(1,9);

for c=10^3:10^4:10^10^5;

c

while max(abs(p(ind,:)-q))>10^(-4)

q=p(ind,:)

ind=ind+1;

for i=1:9

g=(W/R)*(h(i)*pj)/(sum(h(1:(i-1)).*p(ind-1,1:(i-1)))+sum(h((i+1):end).*p(ind-1,(i+1):end)) + s2);

pe=0.5.*exp(-g./2);

f=(1-2.*pe).^M;

u=L*R.*f./(M.*pj)-c.*pj;

um=max(u);

kk=find(u==um);

p(ind,i)=pj(kk);

end

end

pfin(ind2,:)=p(ind,:);

ind2=ind2+1;

ind=1;

clear p

p(ind,:)=ones(1,9);

end