📄 magresp.m
字号:
function magresp(g,L,donf);%MAGRESP Magnitude response plot of TF-transform% Usage: magresp(g);% magresp(g,L);% magresp(g,L,'nf');%% MAGRESP(g) will display the magnitude response of the window g.% This is the DFT of g shown on a log scale normalized such that% the peak is 0 db.%% MAGRESP(g,L) does the same, but extends the window to length L.% Always use this mode for FIR windows, and select an L somewhat% longer than the window to make an accurate plot.%% If the input window is real, only the positive frequencies will be% shown. MAGRESP(g,L,'nf') will show the negative frequencies anyway.error(nargchk(1,3,nargin));if nargin<2 L=length(g);end;g=firextend(g,L);% Perform unitaty DFT.FF=abs(fft(g))/sqrt(L);% ScaleFF=FF/max(max(abs(FF)));% Convert to Db. Add eps to avoid log of zero.FF=20*log10(FF+eps);ymin=max(-100,min(min(FF)));donf=0;if iscomplex(g) donf=1;end;if nargin==3 donf=1;end;if donf xrange=-floor(L/2):ceil(L/2)-1; plotff=fftshift(FF); axisvec=[-L/2 L/2 ymin 0];else % Only plot positive frequencies for real-valued signals. xrange=0:floor(L/2); axisvec=[0 L/2 ymin 0]; plotff=FF(1:floor(L/2)+1);end;plot(xrange,plotff);axis(axisvec);xlabel('Frequency');ylabel('Db');legend('off');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -