matlab求dtft,哪里错了?
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/14 07:56:42
matlab求dtft,哪里错了?
L=200;N=200;
w0=0.1*pi;
w = (0:N-1) * 0.2 *pi/N;
n = 0:(L-1);
wh = 0.54 - 0.46 * cos(2*pi*n/(L-1));
xrec = cos(w0*n);xham = wh.*xrec;
Xrec = abs(dtft(xrec,w));Xham = abs(dtft(xham,w));
save xrec.dat xrec/ascii;
save xham.dat xhamc/ascii;
save frec.dat Xrec/ascii;
save fham.dat Xham/ascii;
where
fuction X = dtft(x,w);
[L1,L] = size(x);
z = exp(-j*w);
X = 0;
for n = L-1:-1:0;
X = x(n+1)+z.*X;
end;
%错误为Undefined function 'dtft' for input arguments of type 'double'
怎么解决呢?.
L=200;N=200;
w0=0.1*pi;
w = (0:N-1) * 0.2 *pi/N;
n = 0:(L-1);
wh = 0.54 - 0.46 * cos(2*pi*n/(L-1));
xrec = cos(w0*n);xham = wh.*xrec;
Xrec = abs(dtft(xrec,w));Xham = abs(dtft(xham,w));
save xrec.dat xrec/ascii;
save xham.dat xhamc/ascii;
save frec.dat Xrec/ascii;
save fham.dat Xham/ascii;
where
fuction X = dtft(x,w);
[L1,L] = size(x);
z = exp(-j*w);
X = 0;
for n = L-1:-1:0;
X = x(n+1)+z.*X;
end;
%错误为Undefined function 'dtft' for input arguments of type 'double'
怎么解决呢?.
fuction应该为function
文件第一行也写上function test,并存为test.m
文件第一行也写上function test,并存为test.m