Input argument "xval" is undefined. Error in ==> vectorfield at 5 m=length(xval);

조회 수: 5 (최근 30일)
Monica Soto
Monica Soto 2013년 9월 16일
Hello, I am trying to run this program, but I've got this error message. Could you help me please to solve this problem? The script file is
function vectorfield(deqns,xval,yval,zval)
t = 0;
m=length(xval);
n=length(yval);
o=length(zval);
xxval = [];
yyval = [];
zzval = [];
x1=[];
y1=[];
z1=[];
for a=1:m
for b=1:n
for c = 1:o
pts=feval(deqns,t,[xval(a);yval(b);zval(c)]);
x1=[x1;pts(1)];
y1=[y1;pts(2)];
z1=[z1;pts(3)];
xxval = [xxval; xval(a)];
yyval = [yyval; yval(b)];
zzval = [zzval; zval(c)];
end
end
end
arrow=sqrt(x1.^2+y1.^2+z1.^2);
u = x1./ar if truerow;
v = x1./arrow;
w = x1./arrow;
quiver3(xxval,yyval,zzval,u,v,w);
axis tight;
Thanks

답변 (1개)

Jan
Jan 2013년 9월 16일
"xval" is undefined, if you did not provide it as input. You have to call this function in a way like:
vectorfield(@Equation, 1, 2, 3)
Due to the absence of a documentation in this function, I cannot guess how the inputs should look like exactly.
Please post a complete copy of the error message inside the text of the question. In this case, as in almost all others also, the complete message contains exactly the information I gave, but in a less specific formulation.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by