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!