While playing code, finding following error.

Error in Agrad_descent>@(x1,x2)((x1).^2+2*(x2).^2-4*(x1)-2*(x1.x2)) (line 40)
f = @(x1,x2)((x1).^2+2*(x2).^2-4*(x1)-2*(x1.x2));
Error in Agrad_descent>@(x)f(x(1),x(2)) (line 44)
f2 = @(x) f(x(1),x(2));
Error in Agrad_descent (line 128)
fopt = f2(xopt);
Following code written:
f = @(x1,x2)((x1).^2+2*(x2).^2-4*(x1)-2*(x1.x2));
f2 = @(x) f(x(1),x(2));
fopt = f2(xopt);

1 件のコメント

Rik
Rik 2022 年 11 月 3 日
Backup of question:
While playing code, finding following error.
Error in Agrad_descent>@(x1,x2)((x1).^2+2*(x2).^2-4*(x1)-2*(x1.x2)) (line 40)
f = @(x1,x2)((x1).^2+2*(x2).^2-4*(x1)-2*(x1.x2));
Error in Agrad_descent>@(x)f(x(1),x(2)) (line 44)
f2 = @(x) f(x(1),x(2));
Error in Agrad_descent (line 128)
fopt = f2(xopt);
Following code written:
f = @(x1,x2)((x1).^2+2*(x2).^2-4*(x1)-2*(x1.x2));
f2 = @(x) f(x(1),x(2));
fopt = f2(xopt);

サインインしてコメントする。

回答 (1 件)

VBBV
VBBV 2022 年 11 月 2 日

0 投票

f = @(x1,x2)((x1).^2+2*(x2).^2-4*(x1)-2*(x1.*x2))

1 件のコメント

VBBV
VBBV 2022 年 11 月 2 日
Give the multiplication operator in the term
(x1.*x2))

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

質問済み:

2022 年 11 月 2 日

コメント済み:

Rik
2022 年 11 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by