Prev: glmfit without constant
Next: mpc tool
From: maria on 5 Nov 2009 06:56 Hello , I am here again as I need your assistance. My function are: %main function p=[500;500]; for k=1:4 [x, fval, history] = myproblem([p]); end and function [x, fval, history] = myproblem(x0) p=x0; history = []; options = optimset('OutputFcn', @myoutput,'LargeScale','off','MaxFunEvals',2000,'TolX',1.0E-6); % lb=293*ones(2,1); %ub=2200*ones(2,1); % [x,fval,exitflag,output,resnorm]=lsqnonlin (@calculx2,x0,lb,ub,options); [x,fval,exitflag,output,resnorm]=lsqnonlin(@calculx2,x0,[], [],options); function stop = myoutput(x,optimvalues,state)%optimvalues, stop = false; if isequal(state,'iter') history = [history; x]; end end function [objf] = calculx2(x) for i=1:2 F(i)= p(i)- x(i); end objf=sqrt(F(1)^2 + F(2)^2); end end % The value of x is used in another function. My problem is that objf = NaN and so x is Nan Any idea what I use wrong? Thank you, Maria
|
Pages: 1 Prev: glmfit without constant Next: mpc tool |