注册 登录
编程论坛 Matlab

求这个程序里的error如何解决

S17853680398 发布于 2018-04-21 23:10, 3267 次点击
function [f,k]=dconv(f1,f2,k1,k2)
f=conv(f1,f2)
k0=k1(1)+k2(2);
k3=length(f1)+length(f2)-2;
k=k0:k0+k3
subplot(2,2,1)
stem(k1,f1)
title('f1(k)')
xlable('k')
ylable('f1(k)')
subplot(2,2,2)
stem(k2,f2)
title('f1(k)')
xlable('k')
ylable('f2(k)')
subplot(2,2,3)
stem(k,f)
title('f(k)f1(k)与f2(k)的卷积和f(k)')
xlable('k')
ylable('f(k)')
h=get(gca,'position');
h(3)=2.5*h(3)
set(gca,'position',h)

以下是显示的error
??? Input argument "f1" is undefined.

Error in ==> dconv at 2
f=conv(f1,f2)
1 回复
#2
S178536803982018-04-22 15:48
f1(k)=δ(k+1)+2δ(k)+ δ(k-1)
f2(k)= δ(k+2)+ δ(k+1)+ δ(k)+ δ(k-1)+ δ(k-2)
1