我编辑的matlab函数老是出现这种问题:Error using spirallength (line 9) Not enough input arguments.function varargout = spirallength(d,n,varargin)%SPIRAL \x09\x09\x09\x09\x09画出螺旋线或螺旋条带Nin = length(varargin) + 1;% erro
来源:学生作业帮助网 编辑:作业帮 时间:2024/12/04 17:14:04
我编辑的matlab函数老是出现这种问题:Error using spirallength (line 9) Not enough input arguments.function varargout = spirallength(d,n,varargin)%SPIRAL \x09\x09\x09\x09\x09画出螺旋线或螺旋条带Nin = length(varargin) + 1;% erro
我编辑的matlab函数老是出现这种问题:Error using spirallength (line 9) Not enough input arguments.
function varargout = spirallength(d,n,varargin)
%SPIRAL \x09\x09\x09\x09\x09画出螺旋线或螺旋条带
Nin = length(varargin) + 1;
% error(nargchk(1,Nin,nargin))
if nargout > 1
error('Too many output arguments!')
end
j = sqrt(-1);
phi = 0:pi/20 :n*2*pi;
amp = 0:d/40 :n*d;
spir = amp .* exp(j*phi);
if nargout==0
switch Nin
case 1
plot(spir,'b')
case 2
d1=varargin{1};
amp1 = (0:d/40 :n*d) + d1; spir1 = amp1 .* exp(j*phi);
plot(spir,'b');hold on;plot(spir1,'b');hold off
otherwise
d1=varargin{1};
amp1 = (0:d/40 :n*d) + d1; spir1 = amp1 .* exp(j*phi);
plot(spir,varargin{2:end});hold on;plot(spir1,varargin{2:end});
end;
axis('square')
else
phi0 = 0:pi/1000 :n*2*pi;
amp0 = 0:d/2000 :n*d;
spir0 = amp0 .* exp(j*phi0);
varargout{1} = sum(abs(diff(spir0)));
if Nin>1
d1=varargin{1};
amp1 = (0:d/2000 :n*d) + d1; spir1 = amp1 .* exp(j*phi);
varargout{2} = sum(abs(diff(spir1)));
end;
end
我编辑的matlab函数老是出现这种问题:Error using spirallength (line 9) Not enough input arguments.function varargout = spirallength(d,n,varargin)%SPIRAL \x09\x09\x09\x09\x09画出螺旋线或螺旋条带Nin = length(varargin) + 1;% erro
是说
spirallength
这个函数你在使用的时候,输入参数不够,.你怎么调用这个函数的