我编辑的matlab函数老是出现这种问题:Error using spirallength (line 9) Not e
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/06/07 21:36:10
我编辑的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
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
是说
spirallength
这个函数你在使用的时候,输入参数不够,.你怎么调用这个函数的
再问: 我刚学,我直接调用书籍里面的粒子,打开后直接运行的
再答: 你刚学就学这么复杂的??、、、你这似乎还没懂matlab函数的概念啊。。。
再问: 我捣鼓明白了
函数文件和M文件有区别 的 ,如果我直接在编译器中运行 也会发生这样错误;
我就是直接运行的。操作方式不对
spirallength
这个函数你在使用的时候,输入参数不够,.你怎么调用这个函数的
再问: 我刚学,我直接调用书籍里面的粒子,打开后直接运行的
再答: 你刚学就学这么复杂的??、、、你这似乎还没懂matlab函数的概念啊。。。
再问: 我捣鼓明白了
函数文件和M文件有区别 的 ,如果我直接在编译器中运行 也会发生这样错误;
我就是直接运行的。操作方式不对
我编辑的matlab函数老是出现这种问题:Error using spirallength (line 9) Not e
matlab的inline函数报错Error using inline/feval (line 23)Not enoug
请问下面的程序有错吗?matlab老是提示Error using stem (line 44) X must be sa
matlab 错误Error using zy (line 4) Not enough input arguments.
用MATLAB运行代码后总显示 Error using Untitled (line 2) Not enough inp
Matlab中出现Error using ==> .*
matlab问题!Error using ==>
MATLAB的问题.Error:File:F:\work\Untitled3.m Line:1 Column:9 Mis
matlab中老是出现这个错误怎么改呀 Error using ==> mtimes Inner matrix dime
matlab 问题? Error using ==> initial at 71 Not enough input ar
Matlab ,error using eq
MATLAB编程问题弹出了这样的问题:Error using / Matrix dimensions must agre