matlab 求DTFT编程问题,请教高手哪里错了?function testL = 200; N = 200;w0 = 0.1*pi;w = (0:N-1) * 0.2 * pi / N; % frequency rangen = 0:(L-1);wh = 0.54 - 0.46 * cos(2*pi*n/(L-1)); % Hamming windowxrec = cos(w0 * n);xham = wh .* xrec; % windo

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 02:38:16
matlab 求DTFT编程问题,请教高手哪里错了?function testL = 200; N = 200;w0 = 0.1*pi;w = (0:N-1) * 0.2 * pi / N; % frequency rangen = 0:(L-1);wh = 0.54 - 0.46 * cos(2*pi*n/(L-1)); % Hamming windowxrec = cos(w0 * n);xham = wh .* xrec; % windo
xTOQWYڊ%N[]wrB@ ?kHA1ZJgv'mr5fy3L65F}?24j>,Mٯ{kW^pWJZu3qTEM+ w?Op۰hģ}]MhJpo_7DǷB AS{aq^BJcp.$?wLFXLtIQUAsXEXwT E0_4Y":5b7j_/i +B!/E]7GPQ(*M'aNK2u\A@Ljq^+N,<(B€1sj[ЍB7[3ײ;'.P^u; ߣt 0 *zN @K$b!Nn/JJ >LNY^|^Яf$`S[**Si1(0Eղp*.jA5q̢%+yΏ9םt*_* %h'l]?k=ԩ 6^OSN@,;-Ϛe9.;{[edU'KNc>{Yy]^tNz#Né;h{

matlab 求DTFT编程问题,请教高手哪里错了?function testL = 200; N = 200;w0 = 0.1*pi;w = (0:N-1) * 0.2 * pi / N; % frequency rangen = 0:(L-1);wh = 0.54 - 0.46 * cos(2*pi*n/(L-1)); % Hamming windowxrec = cos(w0 * n);xham = wh .* xrec; % windo
matlab 求DTFT编程问题,请教高手哪里错了?
function test
L = 200; N = 200;
w0 = 0.1*pi;
w = (0:N-1) * 0.2 * pi / N; % frequency range
n = 0:(L-1);
wh = 0.54 - 0.46 * cos(2*pi*n/(L-1)); % Hamming window
xrec = cos(w0 * n);
xham = wh .* xrec; % windowed data
Xrec = abs(dtft(xrec, w)); % DTFT of rectangular data
Xham = abs(dtft(xham, w)); % DTFT of Hamming data
save xrec.dat xrec /ascii;
save xham.dat xham /ascii;
save frec.dat Xrec /ascii;
save fham.dat Xham /ascii;
where
function 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
%提示错误Error: Function definitions are not permitted in this context.该怎么解决?

matlab 求DTFT编程问题,请教高手哪里错了?function testL = 200; N = 200;w0 = 0.1*pi;w = (0:N-1) * 0.2 * pi / N; % frequency rangen = 0:(L-1);wh = 0.54 - 0.46 * cos(2*pi*n/(L-1)); % Hamming windowxrec = cos(w0 * n);xham = wh .* xrec; % windo

程序没问题啊(除了中间的那个where要删掉),但运行没有什么提示,只产生了几个数据文件,已打包后作为附件上传.