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 Commento

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);

Accedi per commentare.

Risposte (1)

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

Categorie

Scopri di più su Creating, Deleting, and Querying Graphics Objects in Centro assistenza e File Exchange

Richiesto:

il 2 Nov 2022

Commentato:

Rik
il 3 Nov 2022

Community Treasure Hunt

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

Start Hunting!

Translated by