Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Status
Not open for further replies.

program2

Newbie level 1
i have sinwave with 0.1 v amplitude and 1khz frequency mixed with 5v white noise.
i used FFT in Matlab to simulate.

1-(Study the use of additional mean value calculation of every data set of FFT spectrum and how it affects the visibility of a present signal.). so, how can i use additional mean value???????????

2-Which window is the best for detecting weak signals in a noisy background?
i used some of windows but all are not useful!!!!!

Matlab code :

f1=1000; % Signal frequency
fs=5000; % Sampling frequency
N=128; % Number of samples
N1=2048; % Number of FFT points
p=128; % Define Number of samples noise
n=0:N-1; % Index n
f=(0:N1-1)*fs/N1; % Defining the frequency points [axis]
noise=rand(1,p); % Generate Uniformly Random Numbers
x=0.1*sin(2*pi*f1*n/fs)+5*noise; % Generate the signal
XR=abs(fft(x,N1)); % find the magnitude of the FFT using No
% windowing (i.e. Rectangular window)
xh=hamming(N); % Define the hamming samples
xw1=x .* xh'; % Window the signal
XH=abs(fft(xw1,N1)); % find the magnitude of the FFT of the
% windowed signal.
xha=hanning(N); % Define the hanning samples
xw2=x .* xha'; % Window the signal
XHA=abs(fft(xw2,N1)); % find the magnitude of the FFT of the
% windowed signal.
xbl=blackman(N); % Define the blackman samples
xw3=x .* xbl'; % Window the signal
XBL=abs(fft(xw3,N1)); % find the magnitude of the FFT of the
% windowed signal.
xba=bartlett(N); % Define the bartlett samples
xw4=x .* xba'; % Window the signal
XBA=abs(fft(xw4,N1)); % find the magnitude of the FFT of the
% windowed signal.
subplot(3,2,1); % Start plotting the signal
plot(f(1:N1/2),20*log10(XR(1:N1/2)/max(XR)));
title('Spectrum of x(t) using Rectangular Windows');
grid;
xlabel('Frequency, Hz');
ylabel('Normalised Magnitude, [dB]');
subplot(3,2,2);
plot(f(1:N1/2),20*log10(XH(1:N1/2)/max(XH)));
title('Spectrum of x(t) using Hamming Windows');
grid;
xlabel('Frequency, Hz');
ylabel('Normalised Magnitude, [dB]');
subplot(3,2,3);
plot(f(1:N1/2),20*log10(XHA(1:N1/2)/max(XHA)));
title('Spectrum of x(t) using Hanning Windows');
grid;
xlabel('Frequency, Hz');
ylabel('Normalised Magnitude, [dB]');
subplot(3,2,4); % Start plotting the signal
plot(f(1:N1/2),20*log10(XBL(1:N1/2)/max(XBL)));
title('Spectrum of x(t) using Blackman Windows');
grid;
xlabel('Frequency, Hz');
ylabel('Normalised Magnitude, [dB]');
subplot(3,2,5); % Start plotting the signal
plot(f(1:N1/2),20*log10(XBA(1:N1/2)/max(XBA)));
title('Spectrum of x(t) using Bartlett Windows');
grid;
xlabel('Frequency, Hz');
ylabel('Normalised Magnitude, [dB]');