genetic algorithm- need help
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
i am not able to estimate the parameters using optimisation(solver GA) toolbox.
function error= work(k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11)
load coalinput1;
load wa1;
load toh;
load pmillh1;
for i=1:30
mc(s)=coalinput1/(k1*(1/k1)*s+1);
mpf(s= k1*mc/(k2*50)*(s/k2*50+1);
pmill(s)=k3*mc(s)+k4*mpf+k6*50/(k5*((s/k5)+1));
to(s)=((k7*250+k8)*wa1)+ k9*coalinput1- (k11*wa1+ k11*coalinput1)/((wa1*k10+coalinput1*k10)*((S/wa1*k10+coalinput1*k10)+1));
error=0.5*(to(s)-toh).^2+ 0.5*(pmill(s)-pmillh1).^2;
end
end
All the loaded inputs are of 61X2 double type
Error is Matrix dimensions must agree.
0 件のコメント
回答 (1 件)
In Matlab, when you have two matrices, say A of size 3 * 4, and B of size 4 * 12, if you multiply A*B the result will be a matrix of size 3*12. You cannot multiply two matrices which have not the same size along one of their dimensions, and the order in which you multiply them matters. It seems to me that what you want to do is to multiply element by element. If you want to do that then:
k11*coalinput1
should be written as:
k11.*coalinput1
The dot is important, it indicates multiplication element by element. Same goes for the power: A.^2 squares every element in A. A^2 squares the matrix. Same rules apply for the division.
Cheers!
0 件のコメント
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!