Borrar filtros
Borrar filtros

I'm missing something....

1 visualización (últimos 30 días)
Will
Will el 16 de Feb. de 2012
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

Respuestas (0)

Categorías

Más información sobre Linear Least Squares en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by