i don`t know how i can improve the performance of this genetic algorithm file can any one help me ?

1 view (last 30 days)
% this the function : function abse =newone1(w) d = .5; % element spacing in terms of wavelength d = lambda/2 N =6; % number of elements in array global m
thetaS =30; % input(' What is the desired users AOA (in degrees)? '); thetaI =-60; % input(' What is the interferers AOA(in degrees)? '); %----- Desired Signal & Interferer -----% T=1E-3; t=(1:1000)*T/1000; %it=1:100; S=cos(2*pi*t/T); thetaS = thetaS*pi/180; % desired user AOA I = randn(1,1000); thetaI = thetaI*pi/180; % interferer AOA
%----- Create Array Factors for each user's signal for linear array -----%
vS = []; vI = []; i=1:N/2; vS=exp(1j*(i-1)*2*pi*d*sin(thetaS)).'; vI=exp(1j*(i-1)*2*pi*d*sin(thetaI)).';
%----- Solve for Weights using LMS -----%
m=m+1;
b=floor (m/301)+1;
x = S(b).*vS + I(b).*vI;
%y = w*x.';
%y=w*x;
w;
w1=[ w(:,1)+j*w(:,2) w(:,3)+j*w(:,4) w(:,5)+j*w(:,6) ];
y=w1*x;
e =(S(b))- y;
abse=abs(e);
end
% the general program which run :clear clc close all global m m=1; thetaS =30; ObjectiveFunction = @newone1; nvars =6; % Number of variables LB = [0 0 0 0 0 0]; % Lower bound UB = [1 1 1 1 1 1]; % Upper bound d = .5; % element spacing in terms of wavelength d = lambda/2
options = gaoptimset('PopulationSize',300,'CreationFcn', {@gacreationuniform},'FitnessScalingFcn', {@fitscalingprop},'SelectionFcn',@selectionroulette,'MutationFcn',@mutationadaptfeasible,'CrossoverFcn',@crossoverheuristic,'FitnessLimit',0.0001,'Generations',100);%'InitialPopulation',X0);
options = gaoptimset(options,'PlotFcns',{@gaplotbestf,@gaplotstopping,@gaplotbestindiv}, ... 'Display','iter');% Next we run the GA solver.%@gaplotrang [x,fval,exitFlag,Output, population,scores] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB,[],options) theta = -pi/2:.01:pi/2; AF = zeros(1,length(theta));
x=[x(:,1)+j*x(:,2) x(:,3)+j*x(:,4) x(:,5)+j*x(:,6)];
% Determine the array factor for linear array for i = 1:nvars/2
AF = AF +x(i)'.*exp(1j*(i-1)*2*pi*d*sin(theta));
end
  3 Comments
Image Analyst
Image Analyst on 28 Aug 2013
Edited: Image Analyst on 28 Aug 2013
Edit the message, highlight the code that's not formatted properly yet, then click the {}Code button. You can fix the indenting by putting the code into a MATLAB code editor window, and typing control-a then control-i.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!