MATLAB程序总是出现?Error using ==> stem at 44 X must be same length as Y.%hammingchuang.mM=11;n=[0:1:M-1];wc=0.3*pi;hd=ideal_lp(wc,M);w_rec=(boxcar(M))';w_ham=(hamming(M))';h_rec=hd.*w_rec;h_ham=hd.*w_ham;[db1,mag1,pha1,grd1,w1]=freqz_m(h_rec,[
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/17 03:32:30
MATLAB程序总是出现?Error using ==> stem at 44 X must be same length as Y.%hammingchuang.mM=11;n=[0:1:M-1];wc=0.3*pi;hd=ideal_lp(wc,M);w_rec=(boxcar(M))';w_ham=(hamming(M))';h_rec=hd.*w_rec;h_ham=hd.*w_ham;[db1,mag1,pha1,grd1,w1]=freqz_m(h_rec,[
MATLAB程序总是出现?Error using ==> stem at 44 X must be same length as Y.
%hammingchuang.m
M=11;
n=[0:1:M-1];
wc=0.3*pi;
hd=ideal_lp(wc,M);
w_rec=(boxcar(M))';
w_ham=(hamming(M))';
h_rec=hd.*w_rec;
h_ham=hd.*w_ham;
[db1,mag1,pha1,grd1,w1]=freqz_m(h_rec,[1]);
[db2,mag2,pha2,grd2,w2]=freqz_m(h_ham,[1]);
figure(1)
subplot(2,2,1);stem(n,hd,'k');grid
title('加窗前脉冲响应')
axis([0 M-1 -0.2 0.5]);ylabel('hd(n)')
subplot(2,2,2);stem(n,h,'k');grid
title('加窗后脉冲响应')
axis([0 M-1 -0.2 0.5]);ylabel('h(n)')
subplot(2,2,3);plot(w1/pi,db1,'k');grid
title('加汉明窗前幅频特性(dB)')
axis([0 1 -100 10]);ylabel('Decibels')
set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1])
set(gca,'YTickMode','manual','YTick',[-50,0])
subplot(2,2,4);plot(w2/pi,db2,'k');grid
title('加汉明窗后幅频特性(dB)')
axis([0 1 -100 10]);ylabel('Decibels');
set(gca,'XTickMode','manual','XTick',[0,0.2,0.3,1])
set(gca,'YTickMode','manual','YTick',[-50,0])
运行后出现:
Error using ==> stem at 44
X must be same length as Y.
MATLAB程序总是出现?Error using ==> stem at 44 X must be same length as Y.%hammingchuang.mM=11;n=[0:1:M-1];wc=0.3*pi;hd=ideal_lp(wc,M);w_rec=(boxcar(M))';w_ham=(hamming(M))';h_rec=hd.*w_rec;h_ham=hd.*w_ham;[db1,mag1,pha1,grd1,w1]=freqz_m(h_rec,[
X跟Y两个矩阵的长度不一样啊 没有一一对应的点 matlab是不能给你作图的 而且你这程序需要很多自定义的函数 单贴这个出来也给你运行不了