Info

This question is closed. Reopen it to edit or answer.

i need help with this message undefined function or variable matlab even the vqriqble excite

1 view (last 30 days)
I have this code when i run the function ,I am receiving the following error message,Undefined function or variable A,how can I resolve this issue?
this is the message
Undefined function or variable 'A'.
Error in T (line 21)
df=(sum(sum(A))^-1);
function [teta]=T(X)
global n m
p1=1;
p2=2;
t=1;
for i=2:n
for j=2:m
k=1;
vect=zeros(4,1);
for h=0:p1
for l=0:p2
vect(k)=X(i-h,j-l);
k=k+1;
end
end
f(t,:)= vect(2:4)
A(t)= vect(2:4)'*vect(2:4)
t=t+1;
end
end
df=(sum(sum(A))^-1);
t=0;
for i=2:n
for j=2:m
t=t+1;
g(t,:)=f(t,:)*X(i,j);
end
end
teta=df*sum(g);
end
  3 Comments

Answers (1)

KSSV
KSSV on 5 Feb 2019
function [teta]=T(X,n,m)
p1=1;
p2=2;
t=1;
for i=2:n
for j=2:m
k=1;
vect=zeros(4,1);
for h=0:p1
for l=0:p2
vect(k)=X(i-h,j-l);
k=k+1;
end
end
f(t,:)= vect(2:4)
A(t)= vect(2:4)'*vect(2:4)
t=t+1;
end
end
df=(sum(sum(A))^-1);
t=0;
for i=2:n
for j=2:m
t=t+1;
g(t,:)=f(t,:)*X(i,j);
end
end
teta=df*sum(g);
end

Community Treasure Hunt

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

Start Hunting!