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/
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/29 23:35:05
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/
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'
怎么解决呢?.
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/
fuction应该为function
文件第一行也写上function test,并存为test.m