📄 fft_demo.asv
字号:
% fft demo
t = 0:.001:.25;
% creat signal
x = sin(2*pi*50*t) + sin(2*pi*120*t);
% add noise and show it
y = x + 2*randn(size(t));
subplot(221)
plot(y(1:50)), title('Noisy time domain signal')
% Power spectral density
Y = fft(y,256);
Pyy = Y.*conj(Y)/256;
f = 1000/256*(0:127);
subplot(222)
plot(f,Pyy(1:128)),
% Zoom in and plot only up to 200 Hz.
subplot(223)
plot(f(1:50),Pyy(1:50)),
title('Power spectral density'),
xlabel('Frequency (Hz)'),
subplot(224)
title('Power spectral density'),
xlabel('Frequency (Hz)'),
plot(f(1:50),Pyy(1:50)),
title('Power spectral density'),
xlabel('Frequency (Hz)'),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -