这个matlab函数为什么会出现Input argument "a" is undefined.function exm5_2(a)% a Define the limit of variable x .x=-a:0.02:a;for i=1:length(x)if x(i)>1y(i)=cos(2*pi*x(i));elseif x(i)

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/10 21:47:36
这个matlab函数为什么会出现Input argument 1y(i)=cos(2*pi*x(i));elseif x(i)" />

这个matlab函数为什么会出现Input argument "a" is undefined.function exm5_2(a)% a Define the limit of variable x .x=-a:0.02:a;for i=1:length(x)if x(i)>1y(i)=cos(2*pi*x(i));elseif x(i)
这个matlab函数为什么会出现Input argument "a" is undefined.
function exm5_2(a)
% a Define the limit of variable x .
x=-a:0.02:a;
for i=1:length(x)
if x(i)>1
y(i)=cos(2*pi*x(i));
elseif x(i)

这个matlab函数为什么会出现Input argument "a" is undefined.function exm5_2(a)% a Define the limit of variable x .x=-a:0.02:a;for i=1:length(x)if x(i)>1y(i)=cos(2*pi*x(i));elseif x(i)
a是你自定义函数exm5_2中的自变量,在m文件中,你没有赋值,当然没有定义啊!

其中参数a没有定义类型,即没有声明