writing correct fitness function for GA

Hi Friends, Please can anyone help me correct this GA code to minimimize measured and predicted results to extract the three parameters.I got an error message when I run it on matlab GA tool. function Ap = insertionlossnew(x) L1=3; Zcd1=x(1); L2= 24; Zcb=x(2); L3=3; Zcd2=x(3); Ap=eye(1); for f=[1 4 8 10 16 20 25 31.25 62.5 100 200 250 300 400 500]; Ap = (f*((L1)*(Zcd1)+(L2)*(Zcb)+(L3)*(Zcd2))); end Am=[20.3 23.4 24.6 25.3 23.4 26.4 27.5 22.9 23.7 29.8 31.3 32.8 27.9 25.8 35.6]; Y1=sqrt(sum(Ap-Am)^2); Y2=mean(Am,15); disp(Y2); Y3=sqrt(sum(Am-Y2)^2); Y4=Y1/Y3; Y=(1-Y4)*100; disp(Y);

Answers (0)

This question is closed.

Asked:

on 15 Mar 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!