这matlab哪儿错了

来源:百度知道 编辑:UC知道 时间:2024/06/02 16:56:29
function z=sig_produce(input,long,a,b,c,d,e);
if input==1
n=0:long
x1=[1 zeros(1,long)]
stem(n,x1)
elseif input==2
n=0:long
x2=[1 ones(1,long)]
stem(n,x2)
elseif input==3
n=0:long
x3=2*sin(pi*n/a+pi/b)
stem(n,x3)
elseif input==4
n=0:long
x4=c*exp(j*d*n)
stem(n,x4)
elseif input==5
n=0:long
x5=e.^n
stem(n,x5)
else error('wrong')
end

第一句函数没有输出参数吗
如果没有返回值,就直接用function sig_produce(input,long,a,b,c,d,e)
并且将文件命名为sig_produce.m。
不过你后面的程序也不是都正确,鉴于时间关系,留给你自己解决。

第一句函数声明的时候 不要用z=。。因为不是返回某一个值,直接:
function sig_produce(input,long,a,b,c,d,e)