solving a multi variables function equal to zero uzing fzero
이전 댓글 표시
i was trying to solve this code
format loose
format compact
format long
m=[ 4000 50 ] ;
s= [400 5 ] ;
r=[1 0.5 , 0.5 1 ];
q=[1 1 ] ;
ls=[];
n=length(m) ;
for i = 1 : n
eval(sprintf('syms x%i,',i));
eval(sprintf('x(%i) = x%i;', i, i));
end
Y= @(x1, x2) 29-(6*x(1))-(18*x(2));
for i=1:n
if i<n
xi=m(i);
disp(x);
disp(i);
else
last=m(n)
xi = fzero(Y,last)
%=>>>>>>>>>>>>>> 5
end
end
i was trying to obtain the value of the last varible in the function Y=0 but i am getting this error :
Error using fzero (line 328)
Function value at starting guess must be finite and real.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!