I'm missing something....
조회 수: 3 (최근 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!