フィルターのクリア

Unrecognized function or variable 'seccionAurea'.

2 ビュー (過去 30 日間)
ataberk kaplica
ataberk kaplica 2020 年 12 月 21 日
回答済み: Tarunbir Gambhir 2020 年 12 月 24 日
function powellmethod
max=0;
f=@(x1,x2) 25*(x1)^2+2.5*(x2)^2+15*(x1)*(x2)-25*(x1)-10*(x2);
grad={@(x1,x2) 50*(x1)+15*(x2)-25; @(x1,x2) 5*(x2)+15*(x1)-10};
x0=[2;2];
tol=0.045;
Maxiter=100;
bk=5;
n=size(x0,1);
iter=1;
D=eye(n);
y1=x0;
k=1;
j=1;
d=zeros(n,1);
alpha=0;
Fgrad=[grad{1}(y1(1),y1(2)); grad{2}(y1(1),y1(2)) ] ;
Da(iter,:)={iter, x0 , d ,alpha,Fgrad,x0};
iter=iter+1;
while norm(Fgrad)>tol && iter<=Maxiter
d=-D*Fgrad;
[alpha]=seccionAurea(f,x0,d,bk,max)
x1=x0+alpha*d;
y1=x1;
Fgrad=[grad{1} y1(1) ,y1(2);
grad{2} y1(1),y1(2)];
Da(iter,:)={iter,x0 , d , alpha , Fgrad, x1};
x0=x1;
if norm(Fgrad)<tol
break
end
p=Da{iter,4}*Da{iter,3};
q=Da{iter,5}*Da{iter-1,5};
D=D+((p*p')/(p'*q))-((D*q*q'*D)/(q'*D*q));
iter=iter+1;
end
code gives error when run it , same code work in my teacher laptop but gives me an error ,code is %100 same with teacher

回答 (1 件)

Tarunbir Gambhir
Tarunbir Gambhir 2020 年 12 月 24 日
On your teachers machine, use "which" function to locate where the function "seccionAurea" is defined.
which seccionAurea
Make sure that this file is on the MATLAB path for your machine. Refer to this question for how to set path for user defined functions.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by