MATLAB: Hi I’m trying to execute the below code to observe the impact of noise on the FFT of the signal. Even if i’m increasing noise content there is little impact on the signal’s Spectrum. Why

effect of noise on fft of signal

if true
% clc
clear all
close all
A=10;
F=2; %Signal Frequency
fs=50*F; %Sampling Frequency
t=0:1/fs:49*1/F; %Time Duration
%Original Signal
x=A*sin(2*pi*F*t);
subplot(511)
plot(t,x)
xlabel('time')
ylabel('X')
title('Original Signal')
%Adding Noise to the signal
n=8*randn(1,length(x));
y=x+n;
N=length(y);
subplot(512)
plot(t,y)
axis([0 inf -10 10])
xlabel('time')
ylabel('y')
title('Signal with Noise')
%Spectral Analysis of Noisy Signal
L=length(y);
NFFT=2^nextpow2(L);
y_fft=1/NFFT*abs(fft(y,NFFT));
f=fs/2*linspace(0,1,NFFT/2+1);
subplot(513)
plot(f,y_fft(1:length(f)))
xlabel('f')
ylabel('y_fft')
title('FFT of Noisy Signal')
end

Best Answer

Your signal is a sinusoidal signal. All its energy is concentrated to one frequency. On the other hand, noise power spreads all over entire spectrum.
Related Question