%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This code is to find the best P for max SINR using beta cost function % % Made by Jie Lian % University of Virginia % 2014/2/12 % USA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clc; clear; close all; tic mimo_h1=load('MIMO_h_1.mat'); mimo_h2=load('MIMO_h_2.mat'); mimo_h3=load('MIMO_h_3.mat'); mimo_h4=load('MIMO_h_4.mat'); mimo_h1=mimo_h1.P_floor_LED_1; mimo_h2=mimo_h2.P_floor_LED_2; mimo_h3=mimo_h3.P_floor_LED_3; mimo_h4=mimo_h4.P_floor_LED_4; N=2; % N is the number of transmitters K=2; % K is the number of users % rec_x=[10,25]; % receiver's positions % rec_y=[20,35]; % rec_x=[10,25,12]; % receiver's positions % rec_y=[20,35,12]; rec_x=[10,25,12,45]; % receiver's positions rec_y=[20,35,12,20]; %% establish the mimo channel matrix H for i=1:K H(1,i)=mimo_h1(rec_x(i),rec_y(i)); H(2,i)=mimo_h2(rec_x(i),rec_y(i)); % H(3,i)=mimo_h3(rec_x(i),rec_y(i)); end %% establish the cdma code matrix C C=OCDMA(K); %% establish the Va matrix which represents the expectation matrix % Va=E[d'd] Va=0.25*(eye(K)+ones(K,K)); %% Initial setting, Matrix P and sigma2 of noise P=zeros(N,K); sigma2=0.0003; % P=[5 5;5 5]; P_best=[0 0 ;0 0]; P_l=0:1:10; L=length(P_l); SINR_k_o=0; V=1.e10; % beta cost function beta=100; for ii=1:L P_l(ii); for jj=1:L-ii+1 for i=1:L for j=1:L-i+1 P(1,1)=P_l(i); P(1,2)=P_l(j); P(2,1)=P_l(ii); P(2,2)=P_l(jj); for k=1:K W_k(:,k)=W(C,H,P,E(K,k),Va,q(K,k),sigma2,k); SINR_k(k)=SINR(W_k(:,k),C,H,P,E(K,k),Va,A(K,k),sigma2,k); end V_new=sum((1./SINR_k).^(1+beta)); if V_new