Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

correct code for this fitness function for GA

Status
Not open for further replies.

shegmite

Member level 1
Joined
Apr 8, 2012
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,496
Hi Friends,
Please can anyone help me correct this GA code to minimize measured and predicted results to extract the three parameters and calculate the root mean square error.I got an error message when I run it using the matlab gatool.
Code:
function Ap = attenuation(x)
L1=3;
Zcd1=x(1);
L2= 24;
Zcb=x(2);
L3=3;
Zcd2=x(3);
85<=x(1)<=100; 
85<=x(2)<=115;
85<=x(3)<=100; 
f =[1 4 8 16 20 32.5 62.5 100 200 300 400 500];
z = f*((L1)*x(1)+(L2)*x(2)+(L3)*x(3));
y=[20.3 23.4 24.6 25.3 23.4 26.4 27.5 22.9 23.7 29.8 31.3 32.8];
Ap=lsqcurvefit(y-z);
err = z - y;
squareError = err.^2;
meanSquareError = mean(squareError);
rootMeanSquareError = sqrt(meanSquareError);
disp(rootMeanSquareError);
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top