Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

error running optimisation while running ga toolbox

조회 수: 1 (최근 30일)
raiyan aftab
raiyan aftab 2017년 4월 5일
마감: MATLAB Answer Bot 2021년 8월 20일
fitness function must return a scalar value function [sol, val] = fitness(sol,options)
global harm_n
M=sol;
N=4096; %N is a power of 2
kk=max(size(sol))-1;
V=125*ones(1,kk);
[fftvao v]=modulation(N,M,V);
vv=abs(fftvao(2));
sumh=0;
for g=1:harm_n
h5=abs((fftvao(6*g+1+1))); %(6n+1)th harmonic
h7=abs((fftvao(6*g-1+1))); %(6n-1)th harmonic
sumh=sumh+h5+h7;
end
val=-100*(sumh)/vv;
  댓글 수: 1
Alan Weiss
Alan Weiss 2017년 4월 6일
Please mark your code with the {} Code button to make it more readable. Please include your ga call, something like
x = ga(@(sol)fitness(sol,fitness),3)
Then please copy and paste the full, entire error message into your question. That way we might have a chance to understand what is going on and maybe even help.
Alan Weiss
MATLAB mathematical toolbox documentation

답변 (0개)

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by