A signal can be represented in two domains, the first one is Time Domain and the other one is Frequency Domain.
We will show you the advantage of frequency domain analysis and will introduce the DFT using FFT Algorithm using MATLAB, we will also separate noise from the signal with the help of a filter.
First of all we will create a Sinusoidal signal having frequency 100Hz in MATLAB as illustrated in figure and then plot its Discrete Fourier Transform(DFT) in MATLAB using FFT Algorithm.
After this we will add noise to the signal and then again calculate the Discrete Fourier Transform of the Signal, these both plots are illustrated below:-
Now we will compare the Discrete Fourier Transform of both the Signals with noise and without noise, which is illustrated below in the figure:-
Clearly from the above comparison of the signals Peak is located at 100Hz Frequency and the Transform with noise is having amplitude over wider range of frequency.
The code with few correction's with reference to video is as follow:-
We will show you the advantage of frequency domain analysis and will introduce the DFT using FFT Algorithm using MATLAB, we will also separate noise from the signal with the help of a filter.
First of all we will create a Sinusoidal signal having frequency 100Hz in MATLAB as illustrated in figure and then plot its Discrete Fourier Transform(DFT) in MATLAB using FFT Algorithm.
After this we will add noise to the signal and then again calculate the Discrete Fourier Transform of the Signal, these both plots are illustrated below:-
Now we will compare the Discrete Fourier Transform of both the Signals with noise and without noise, which is illustrated below in the figure:-
Clearly from the above comparison of the signals Peak is located at 100Hz Frequency and the Transform with noise is having amplitude over wider range of frequency.
The code with few correction's with reference to video is as follow:-
%% Author :- Embedded Laboratory %%This Project shows how to apply FFT on a signal and its physical % significance. fSampling = 10000; %Sampling Frequency tSampling = 1/fSampling; %Sampling Time L = 10000; %Length of Signal t = (0:L-1)*tSampling; %Time Vector F = 100; %Frequency of Signal %% Signal Without Noise xsig = sin(2*pi*F*t); subplot(2,1,1) plot(t,xsig); grid on; axis([0 0.1 -1.2 +1.2]) xlabel('\itTime Axis \rightarrow'); ylabel('\itAmplitude \rightarrow'); title('\itxsig(t) of Frequency = 100Hz'); pause(2); %%Frequency Transform of above Signal subplot(2,1,2) NFFT = 2^nextpow2(L); Xsig = fft(xsig,NFFT)/L; f1 = fSampling/2*(linspace(0,1,NFFT/2+1)); semilogy(f1,2*abs(Xsig(1:NFFT/2+1)),'r'); grid on; axis([-50 500 1.0000e-005 1]) title('\itSignle-Sided Amplitude Sepectrum of xsig(t)'); xlabel('\itFrequency(Hz) \rightarrow'); ylabel('|Xsig(f)| \rightarrow'); pause(2); %% Addition of Noise in Signal when Signal is Transmitted over some % transmission medium xnoise = xsig +0.25*randn(size(t)); figure; subplot(2,1,1) plot(t,xnoise,'r'); grid on; xlabel('\itTime Axis \rightarrow'); ylabel('\itAmplitude \rightarrow'); title('\itxnoise(t) of Frequency = 100Hz (Noise Addition)'); pause(2); %%Frequency Transform of the Noisy Signal subplot(2,1,2) NFFT = 2^nextpow2(L); XNoise = fft(xnoise,NFFT)/L; f1 = fSampling/2*(linspace(0,1,NFFT/2+1)); semilogy(f1,2*abs(XNoise(1:NFFT/2+1)),'r'); grid on; axis([-50 500 1.0000e-005 1]) title('\itSignle-Sided Amplitude Sepectrum of xnoise(t)'); xlabel('\itFrequency(Hz) \rightarrow'); ylabel('|XNoise(f)| \rightarrow'); pause(2); %%Comparision of both Spectrums figure; subplot(2,1,1) semilogy(f1,2*abs(Xsig(1:NFFT/2+1))); grid on; axis([-50 500 1.0000e-005 1]) title('\itSignle-Sided Amplitude Sepectrum of xsig(t)'); xlabel('\itFrequency(Hz) \rightarrow'); ylabel('|Xsig(f)| \rightarrow'); subplot(2,1,2) semilogy(f1,2*abs(XNoise(1:NFFT/2+1)),'r'); grid on; axis([-50 500 1.0000e-005 1]) title('\itSignle-Sided Amplitude Sepectrum of xnoise(t)'); xlabel('\itFrequency(Hz) \rightarrow'); ylabel('|XNoise(f)| \rightarrow');
No comments:
Post a Comment