?? Error using ==> times Matrix dimensions must agree.
Show older comments
Hi everyone. When I am executing the below given program, I got the error message " ??? Error using ==>times Matrix dimensions must agree." Please check the problem and help me to resolve the issue,
datos=[C14; C13; Ptotal; NH4_total; Mgtotal; T; Kest];
Aeq = [0 1 0 0 0 0 0 1 1 1 1 0 0 datos(3);
1 1 0 0 1 1 1 0 1 0 1 0 0 datos(3);
0 0 1 1 0 0 0 0 0 0 0 0 0 datos(3) ;
0 0 0 -1 3 2 1 -2 -1 -1 1 -1 1 0];
beq = [datos(5); datos(3); datos(4); datos(1)-datos(2)];
z=[0 0 0 1 -3 -2 -1 2 1 1 -1 1 -1];
sqrtI=@(x) sqrt(0.5*(x(:,1).*z(:,1).^2+x(:,2).*z(:,2).^2+x(:,3).*z(:,3).^2+x(:,4).*z(:,4).^2+x(:,5).*z(:,5).^2+x(:,6).*z(:,6).^2+x(:,7).*z(:,7).^2+...
x(:,8).*z(:,8).^2+x(:,9).*z(:,9).^2+x(:,10).*z(:,10).^2+x(:,11).*z(:,11).^2+...
x(:,12).*z(:,12).^2+x(:,13).*z(:,13).^2)); %escalar I
F=@(x,sqrtI) (sqrtI(x)./(1+sqrtI(x)))-0.3*sqrtI(x); %escalar F
a=-A_DH.*z.^2;
exponente=@(x,sqrtI,F) times(a,F(x,sqrtI));
lambda=@(x,sqrtI,F) 10.^(exponente(x,sqrtI,F));
uLi=[-1142.65 -1577.3 -26.5 -79.31 -1018.80 -1089.26 -1130.40 -454.8 -1593.84 -626.7 -1511.21 0 -157.29];
uS=-3051.1;
uL=@(x,sqrtI,F,lambda) uLi+R*T*( log(x(:,1:13).*lambda(x,sqrtI,F)) );
G=@(x,sqrtI,F,lambda) [times(x(:,1:13),uL(x,sqrtI,F,lambda)) uS.*x(:,14).*datos(3)] ;
options = gaoptimset('Generations',1000,'StallGenLimit',200,'MutationFcn',@mutationadaptfeasible,...
'PlotFcns',{@gaplotbestf,@gaplotstopping},'Vectorized','on','UseParallel','always');
tic;[x G] = ga(@(x)G(x,sqrtI,F,lambda),14,[],[],Aeq,beq,[],[],[],options);toc
Please Help me. Thank you.,
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!