有关于用句柄@和fsolve配合求解问题。

>> syms x y
>> f = 3*x+y;
>> g = 5*x +3*y +10 ;
>> h = @(x,y)([f;g]);
>> fsolve(h,[0,0],optimset('Display','off'))
如果以这种方式实现,怎么操作才能供使得定义的句柄能够和fsolve共同使用

 Réponse acceptée

yapalof
yapalof le 23 Nov 2022

0 votes

你的版本太老,不支持matlabFunction
syms x y
f = 3*x+y;
g = 5*x +3*y +10 ;
f1 = eval(['@(x,y)',vectorize(f)]);
g1 = eval(['@(x,y)',vectorize(g)]);
h = @(x) [f1(x(1),x(2)); g1(x(1),x(2))];
fsolve(h,[0,0],optimset('Display','off'))

Plus de réponses (0)

Catégories

En savoir plus sur 基本设置 dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!