What is Fourier Transform :
Output :
Fourier Transform is a incredible method of finding the frequencies present in a signal. When we apply fourier transform we get a impulse at that particular sinusoidal frequency present in the incoming signal.
Suppose that the signal is generated using three frequencies fm1 , fm2 and fm3. Now when we observe the fourier transform of this signal we can see three impulses at fm1 , fm2 and fm3.
Suppose that the signal is generated using three frequencies fm1 , fm2 and fm3. Now when we observe the fourier transform of this signal we can see three impulses at fm1 , fm2 and fm3.
So in this program we are going to generate a random signal and note down the frequencies present in that signal. The after applying fourier transform we can check whether we have impulses at that frequencies or not.
Algorithm :
Step 1 : We are going to generate a random signal.
Step 2 : Apply fourier transform to that signal.
Step 3 : Verify.
Program Code :
clc
clear all
close all
fs=input('Enter the sampling frequency');
t=0:1/fs:1;
X=sin(2*pi*0*t);
n=input('Enter the number of frequencies');
frequencies=[];
for i=1:n
fm=randi(fs/2);
X=X+sin(2*fm*t*pi);
frequencies =[frequencies fm];
end
y=fft(X);
keyttu=fftshift(y);
N=-fs/2:1:fs/2;
plot(N,abs(keyttu));
clear all
close all
fs=input('Enter the sampling frequency');
t=0:1/fs:1;
X=sin(2*pi*0*t);
n=input('Enter the number of frequencies');
frequencies=[];
for i=1:n
fm=randi(fs/2);
X=X+sin(2*fm*t*pi);
frequencies =[frequencies fm];
end
y=fft(X);
keyttu=fftshift(y);
N=-fs/2:1:fs/2;
plot(N,abs(keyttu));
frequencies=sort(frequencies)
Inputs Given :
Comments
Post a Comment