Info

This question is closed. Reopen it to edit or answer.

Can anybody please explain this objective function alongwith the ga code??

1 view (last 30 days)
function [y] = obj_function(x,N,compen_len,data_sample,CP_p1_start,CP_p1_end,CP_p2_start,CP_p2_end)
y = zeros(1,1);
data_sample(1,CP_p1_start:CP_p1_end) = x(1:compen_len);
data_sample(1,CP_p2_start:CP_p2_end) = x(compen_len + 1:end);
data_expnd = [zeros(1,N), ifft(data_sample,N), zeros(1,N)];
nfft = 2^nextpow2(length(data_expnd));
Pxx = abs(fft(data_expnd,nfft)).^2;
Pxx = Pxx(1,1:nfft/2);
expan_fact = nfft/N;
crop_start = (CP_p1_start + compen_len)*expan_fact;
crop_end = (CP_p2_end - compen_len)*expan_fact;
N = 1024;
compen_len = 12;
CP_p1_start = LU_start_sub_carr - compen_len ;
CP_p2_end = LU_end_sub_carr + compen_len ;
CP_p1_end = CP_p1_start + compen_len - 1;
CP_p2_start = CP_p2_end - compen_len + 1;
y(1) = mean(abs(Pxx(crop_start:crop_end)));
% y(2) = EC;
% y(3) = Fl;
% y(4) = Pe;
end
function [x,fval] = call_genetic(init_pop,max_gen,time_limit,N,data_sample,compen_len,CP_p1_start,CP_p1_end,CP_p2_start,CP_p2_end)
nvars = 2*compen_len;
options = gaoptimset(@gamultiobj);
options = gaoptimset(options,'Generations',max_gen,'FitnessLimit',0,'TolFun',1e-3,'TimeLimit',time_limit,'Display','iter','PopulationSize',init_pop,'PlotFcns',{@gaplotscorediversity});
LB = -10*ones(1,nvars);
UB = 10*ones(1,nvars);
[x,fval] = gamultiobj(@(x)obj_function(x,N,compen_len,data_sample,CP_p1_start,CP_p1_end,CP_p2_start,CP_p2_end),nvars,[],[],[],[],LB,UB,options);
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!