CS计算机代考程序代写 clear all

clear all
clc

z0=4;%user location
N0=1;% spatial power spectral density N0
P=[20,30];% transmit power
A=(0.05:0.5:150)’;
Capacity=A.*0;

tau=A./z0; %normalized length of the LIS by the distance z0
cita=1./pi*atan(tau.^2./(sqrt(2.*tau.^2+1))); %calculate the transmit efficiency ?
C1=log2(1+cita.*P(1)./N0); % calculate capacity
figure(1)
Color = linspecer(2);
%subplot(2,1,1);
semilogx(A’,C1′,’-*’,’LineWidth’,1.5,’color’,Color(1,:))
hold on
title(‘Variation of capacity’)
xlabel(‘Surface-area A [m^2]’)
ylabel(‘Capacity [nats/s/Hz]’)
grid on

C2=log(1+cita.*P(2)./N0); % calculate capacity
semilogx(A’,C2′,’-o’,’LineWidth’,1.5,’color’,Color(2,:))
legend(‘P=20 dB’,’P=30 dB’,’Location’,’southeast’)
arph=0;%represent the case without HWI,arph=0,
beta=0.5;
% calculate the utility gamma
dN1=cita.*beta.*4.^(beta-0.5).*P(1).*arph.*A.^(2.*beta-1)./((beta+1).*z0.^2.*pi.^(beta+1).*N0+4.^(beta-1).*P(1).*arph.*A.^(2.*beta));
%calculate the offset of utility gamma
gama1=P(1)./(8.*A.*(N0+cita.*P(1))).*(2*tau./(pi.*z0.*sqrt(2.*tau.^2+1).*(tau.^2+1))-dN1);
%
dN2=cita.*beta.*4.^(beta-0.5).*P(2).*arph.*A.^(2.*beta-1)./((beta+1).*z0.^2.*pi.^(beta+1).*N0+4.^(beta-1).*P(2).*arph.*A.^(2.*beta));
%
gama2=P(2)./(8.*A.*(N0+cita.*P(2))).*(2.*tau./(pi.*z0.*sqrt(2.*tau.^2+1).*(tau.^2+1))-dN2);
%upper-bound in case of no HWI,and N0 is neligible
gama0=1./4./z0.^2./atan(tau.^2./sqrt(2*tau.^2+1))./((2.*tau.^2+1).^0.5.*(tau.^2+1));
figure(2)
Color = linspecer(3);
%subplot(2,1,2);
loglog(A’,gama1′,’-*’,’LineWidth’,1.5,’color’,Color(3,:))
hold on
loglog(A’,gama2′,’-bo’,’LineWidth’,1.5,’color’,Color(2,:));
loglog(A’,gama0′,’–r’,’LineWidth’,1.5,’color’,Color(1,:));
title(‘Variation of utility’)
xlabel(‘Surface-area A [m^2]’)
ylabel(‘\gamma [nats/s/Hz/m^2]’)
grid on
legend(‘numerical-P=20dB’,’numerical-P=30dB’,’upper bound’)