📄 fftplot_pad.m
字号:
function f=fftplot(sig, ts)% f=fftplot(signal, ts)%% Plots the first half of the spectrum of the signal.%% ts is the sampling period. If ts is omitted, it is assumed that%[rows,cols] = size(sig);if cols > rows sig = sig';endlen = length(sig);p = ceil(log(length(sig))/log(2));n=2^p;% Windowsig = sig.*blackman(length(sig));% Padsig = [sig' zeros(n-length(sig), 1)']';f = abs(fft(sig));n2 = n/2;spec = db20(f(1:n2)*2/0.42/len);% 2 is for discarding half the fft result % 0.42 is the Blackman window dc gain% spec = spec - max(spec);freq = linspace(0, (n2-1)/(ts*n), n2);plot(freq, spec);f=spec;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -