shegmite
Member level 1
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.
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: