% FOR AWGN.
function [Ptotal] = findtotalpower(Pt2)
% I know Pt, gamma, pe, and I find power required.
global R;

global  gamma;
global Pt;

Pt = Pt2;

[gopt,nmax] = maxnforpt();

%Pt
%nmax

Ptotal = Pt + gamma*log2(nmax);



