solving a multi variables function equal to zero uzing fzero
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!