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