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

 Accepted Answer

yapalof
yapalof on 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'))

More Answers (0)

Categories

Find more on 基本设置 in Help Center and File Exchange

Tags

Asked:

on 23 Nov 2022

Answered:

on 23 Nov 2022

Community Treasure Hunt

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

Start Hunting!