필터 지우기
필터 지우기

Size of Q is undefined

조회 수: 1 (최근 30일)
feeroz babu
feeroz babu 2021년 11월 23일
댓글: feeroz babu 2021년 11월 23일
function [j] = armijo_grad_direction_dnm_f1(P1,VG,sigma)
j = 0;
signal = 0;
nn = size(Q);
n = nn(1);
I = eye(n);
while( signal == 0 && j < MAX_j)
Q = P1^(1/2)*expm(P1^(-1/2)*2^(-j)*VG*P1^(-1/2))*P1^(1/2); % Geodesic with direction 2^(-j)*VG starting at P1.
PHIQ = 1/2*trace(I-2*Q^(-1)+(Q^(-1))^(2)); % Merit Function at Q.
PHIP1 = 1/2*trace(I-2*P1^(-1)+(P1^(-1))^(2));
ARM = PHIQ - PHIP1 - 2^(-j)*sigma*trace(VG*P1^(-1)*VG*P^(-1)); %Armijo Gradient Direction
if(ARM > 0)
j = j+ 1;
else
signal = 1;
end
end
if ( j >= MAX_j)
fprintf('\nArmijo: j not found with %d iterations.\n',MAX_j);
return;
end
end
  댓글 수: 2
KSSV
KSSV 2021년 11월 23일
How did you run the function? What inputs you have used?
feeroz babu
feeroz babu 2021년 11월 23일
I am running this in octave then I got
error: 'P1' undefined near line 4, column 4
error: called from
armijo_newton_direction_dnm_f1 at line 4 column 4

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2021년 11월 23일
You need to define the input variables and then call the function. It seems you are striaght away hitting the f5/ run button so you are getting error.
P1 = define your value ; % enter value
VG = define your value ; % enter input
sigma = define your value ;
% now call the function
j = armijo_grad_direction_dnm_f1(P1,VG,sigma)
  댓글 수: 7
KSSV
KSSV 2021년 11월 23일
Your function name is _armijo_grad_direction_dnm_f1 and you are trying to call armijo_newton_direction_dnm_f2 it seems,
feeroz babu
feeroz babu 2021년 11월 23일
Yes I have two functions. Ok, done. I selected wrong directory. Thank you for your kind help. My code runs.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by