I'm missing something....
1 回表示 (過去 30 日間)
古いコメントを表示
Hi
I have the following code:
xtmp = @(n,a) storextmp(n) + searchtmp(n)*a;
dx1 = @(a) a*searchtmp;
functmp = @(a) 121.126*xtmp(Nvar-1,a)^2*xtmp(Nvar,a)+748.812*xtmp(Nvar-1,a)*xtmp(Nvar,a)+234.323*xtmp(Nvar,a);
a = fmincon(functmp, [0.04 0.05], [], [], [], [], [0.01 0.01], [0.06 0.06], ineqcon1(dx1));
ineqcon is constraint function:
function [c,ceq] = ineqcon1(dx1)
%%%%%%%%%%%%%%%%%%%%%%%%%%%Calculate constants %%%%%%%%%%%%%%%%%%%%%%%%%%%
R = 0.5*(0.05+(0.05+dx1(1)));
rn = dx1(1)/(log(1+(dx1(1)/0.05)));
e = R - rn;
F = 10e3;
ci = 0.025;
A = dx1(1)*dx1(2);
ri = 0.05;
%%%%%%%%%%%%%%%%%%%%%%%%%%%Constraint functions %%%%%%%%%%%%%%%%%%%%%%%%%%
c = ((F*R*ci)/(A*e*ri))-40e6;
ceq = [];
end
What's happening is that when it calculates the value of R and rn, it is using the entire matrix 'dx1' but I only want it to use the value of dx1(1)?
Thanks
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Linear Least Squares についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!