?? samp7_1.m
字號(hào):
%Samp7_1
clf
Nwin=21;n=0:Nwin-1; %數(shù)據(jù)總數(shù)和序列序號(hào)
figure(1)
for ii=1:4
switch ii
case 1
w=boxcar(Nwin); %矩形窗
stext='矩形窗';
case 2
w=hanning(Nwin); %漢寧窗
stext='漢寧窗';
case 3
w=hamming(Nwin); %哈明窗
stext='哈明窗';
case 4
w=bartlett(Nwin); %bartlett窗
stext='Bartelett窗';
end
posplot=['2,2,' int2str(ii)]; %指定繪制窗函數(shù)的圖形位置
subplot(posplot);
stem(n,w); %繪出窗函數(shù)
hold on
plot (n ,w,'r'); %繪制包絡(luò)線
xlabel('n'); ylabel('w(n)'); title(stext);
hold off; grid on
end
figure(2)
for ii=1:4
switch ii
case 1
w=blackman(Nwin); %Blackman 窗
stext='Blackman窗';
case 2
w=triang(Nwin); %三角窗
stext='三角窗';
case 3
w=kaiser(Nwin,4); %Kaiser窗
stext='Kaiser窗(Beta=4)';
case 4
w=chebwin(Nwin,40); %Chebyshev 窗
stext='Chebyshev窗(r=40)';
end
posplot=['2,2,' int2str(ii)];
subplot(posplot);
stem(n,w); %繪出窗函數(shù)
hold on
plot (n,w,'r'); %繪出包絡(luò)線
xlabel('n');ylabel('w(n)');title(stext);
hold off;grid on;
end
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -