Solving equation equal to zero with multivariables

16 ビュー (過去 30 日間)
sarra aloui
sarra aloui 2019 年 5 月 23 日
回答済み: sarra aloui 2019 年 5 月 25 日
m=[ 4000 50 ] ;
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
temp =(-diff(Y,x(i)));
ls=[ls, temp];
end
for i=1:n
if i<n
x(i)=m(i);
disp(x);
disp(i);
else
x(i)=fsolve(Y,double(x));
disp("aa");
%=>>>>>>>>>>>>>> 5
end
end
disp(ls) ;
last=lenght(ls)
first = ls(last)
when i was trying to run this code i got this error:
Error using symengine
Unable to convert expression into double array.
Error in sym/double (line 692)
Xstr = mupadmex('symobj::double', S.s, 0);
i am trying to find a value of x2 with the use of the function y equal to zero and with using x1 equal to 4000

採用された回答

sarra aloui
sarra aloui 2019 年 5 月 25 日
thank you for your help but how can i make it for n number of x that i have (n-1) values of m and i am looking for the last value from the equation Y equal to zero

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by