필터 지우기
필터 지우기

I'm missing something....

조회 수: 1 (최근 30일)
Will
Will 2012년 2월 16일
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개)

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by