⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 speccomp.m

📁 信号处理,是一本国处优秀教材的附带程序源码,相信对大家有用!
💻 M
字号:
function   speccomp(x, ncenter, win, nfft, pltinc)%SPECCOMP    Plots spectra with hamming windows of different %            lengths all centered at the same place.%%   Usage:  speccomp(x, ncenter, win, nfft, pltinc)%%           x : input signal vector%     ncenter : sample number that windows are centered on%         win : vector of window lengths; %                should use odd lengths, e.g. [401,201,101]%        nfft : FFT size%      pltinc : offset of plots (in dB)%---------------------------------------------------------------% copyright 1994, by C.S. Burrus, J.H. McClellan, A.V. Oppenheim,% T.W. Parks, R.W. Schafer, & H.W. Schussler.  For use with the book% "Computer-Based Exercises for Signal Processing Using MATLAB"% (Prentice-Hall, 1994).%---------------------------------------------------------------J = sqrt(-1);x = x(:);       %--- make it a columnnwins = length(win);X = zeros(nfft, nwins);con = 1;coninc = 10^(pltinc/20);for k=1:nwins    n1 = ncenter - fix(win(k)/2);    n2 = ncenter + fix(win(k)/2);    Lh = n2-n1+1;    X(:,k) = con*fft(x(n1:n2).*hamming(Lh), nfft);    con = con/coninc;endf = (0:nfft/2)*(8000/nfft);X = J*20*log10(abs(X(1:nfft/2+1,:))) + (ones(nwins,1)*f).';plot(X)xlabel('Frequency in Hz')ylabel('Log Magnitude in dB')title( 'Short-Time Spectra with Different Window Lengths')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -