在MATLAB中如何對(duì)噪聲信號(hào)進(jìn)行快速傅里葉變換
[導(dǎo)讀]Fs = 1000;??????????? % 采樣頻率
先用上述代碼生成一個(gè)1Hz,1.5s的采樣信號(hào)。
然后我們加入一個(gè)正常的幅值0.7頻率120的正弦波信號(hào)
S = 0.7*sin(2
Fs = 1000;??????????? % 采樣頻率
先用上述代碼生成一個(gè)1Hz,1.5s的采樣信號(hào)。
然后我們加入一個(gè)正常的幅值0.7頻率120的正弦波信號(hào)
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
為該信號(hào)加入零均值白噪聲,方差為4
X = S + 2*randn(size(t));
畫出時(shí)域上的噪聲信號(hào)
plot(1000*t(1:50),X(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('t (milliseconds)')
ylabel('X(t)')
計(jì)算該信號(hào)的FFT
Y = fft(X);
計(jì)算雙邊譜P2,然后計(jì)算單邊譜P1和均值信號(hào)長(zhǎng)度L
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
定義時(shí)域f,并畫出P1
f = Fs*(0:(L/2))/L;
plot(f,P1)
TItle('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
對(duì)原信號(hào)進(jìn)行傅里葉變換
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
plot(f,P1)
TItle('Single-Sided Amplitude Spectrum of S(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
先用上述代碼生成一個(gè)1Hz,1.5s的采樣信號(hào)。
然后我們加入一個(gè)正常的幅值0.7頻率120的正弦波信號(hào)
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
為該信號(hào)加入零均值白噪聲,方差為4
X = S + 2*randn(size(t));
畫出時(shí)域上的噪聲信號(hào)
plot(1000*t(1:50),X(1:50))
title('Signal Corrupted with Zero-Mean Random Noise')
xlabel('t (milliseconds)')
ylabel('X(t)')
計(jì)算該信號(hào)的FFT
Y = fft(X);
計(jì)算雙邊譜P2,然后計(jì)算單邊譜P1和均值信號(hào)長(zhǎng)度L
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
定義時(shí)域f,并畫出P1
f = Fs*(0:(L/2))/L;
plot(f,P1)
TItle('Single-Sided Amplitude Spectrum of X(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')
對(duì)原信號(hào)進(jìn)行傅里葉變換
Y = fft(S);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
plot(f,P1)
TItle('Single-Sided Amplitude Spectrum of S(t)')
xlabel('f (Hz)')
ylabel('|P1(f)|')





