有关于用句柄@和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共同使用

 Respuesta aceptada

yapalof
yapalof el 23 de Nov. de 2022

0 votos

你的版本太老,不支持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'))

Más respuestas (0)

Categorías

Más información sobre 基本设置 en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Nov. de 2022

Respondida:

el 23 de Nov. de 2022

Community Treasure Hunt

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

Start Hunting!