- you either don't have the function or...
- you have the function and it's not on the matlab path, or...
- you have the function and it's on the matlab path but does not receive inputs of type "sym".
Error showing "Undefined function 'vecline' for input arguments of type 'sym'."
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Code:
function vectline(f,crdaxis,crdrange,step)
if max(size(crdaxis))==3
if max(size(crdrange))==6
xmin=crdrange(1);
xmax=crdrange(2);
ymin=crdrange(3);
ymax=crdrange(4);
zmin=crdrange(5);
zmax=crdrange(6);
dx=(xmax-xmin)/step;
dy=(ymax-ymin)/step;
dz=(zmax-zmin)/step;
[px,py,pz]=meshgrid(xmin:dx:xmax,ymin:dy:ymax,zmin:dz:zmax);
junk=subs(f,{crdaxis(1),crdaxis(2),crdaxis(3)},{px,py,pz});
junksize=size(junk);
k=junksize(2);
u=junk(:,1:k/3,:);
v=junk(:,k/3+1:2*k/3,:);
w=junk(:,2*k/3+1:k,:);
quiver3(px,py,pz,u,v,w,0)
else
error('the size of the dimension does not match the range you specified')
end
elseif max(size(crdaxis))==2
if max(size(crdrange))==4
xmin=crdrange(1);
xmax=crdrange(2);
ymin=crdrange(3);
ymax=crdrange(4);
dx=(xmax-xmin)/step;
dy=(ymax-ymin)/step;
[px,py]=meshgrid(xmin:dx:xmax,ymin:dy:ymax);
junk=subs(f,{crdaxis(1),crdaxis(2)},{px,py});
junksize=size(junk);
k=junksize(2);
u=junk(:,1:k/2);
v=junk(:,k/2+1:k);
quiver(px,py,u,v,0)
else
error('the size of the dimension does not match the range you specified')
end
else
error('vector field with more than 3 dimensions can not be plotted')
end
In Command prompt I write the following:
>> syms x y
>> F=[-x,-y]
F =
[ -x, -y]
>> vecline(F,[x,y],[-2,2,-3,3],10)
Undefined function 'vecline' for input arguments of type 'sym'.
1 comentario
Adam Danz
el 15 de Ag. de 2019
Editada: Adam Danz
el 15 de Ag. de 2019
I'm not aware of "vecline", perhaps it's a 3rd party function.
In either case, given the error message these are the possibilities
You can start trouble shooting based on those possibilities. exist() and which() may be useful functions.
Respuestas (1)
Star Strider
el 15 de Ag. de 2019
You misspelled it in your call to it.
You defined it as:
function vectline(f,crdaxis,crdrange,step)
however you called it as:
vecline(F,x,y,-2,2,-3,3,10)
Try this:
vectline(F,x,y,-2,2,-3,3,10)
2 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!