0% found this document useful (0 votes)
40 views6 pages

Fourier Series and FFT Analysis Lab

The document discusses digital signal processing concepts like the discrete Fourier transform (DFT) and fast Fourier transform (FFT). It contains code to generate and plot sample signals as well as their FFT. The key points are: 1) Increasing the number of points N in the FFT results in a smoother curve with more information. 2) A digital sinc function can act as a window to view a signal over particular time intervals. Using a longer length improves the window. 3) Aliasing occurs if the sampling frequency fs is less than twice the highest frequency component of the signal. Taking an FFT with more points N+N/5 reduces but does not eliminate aliasing.

Uploaded by

DannyRao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Topics covered

  • aliasing effect,
  • frequency components,
  • signal dynamics,
  • Fourier transform,
  • signal phase,
  • periodic signals,
  • time-domain signals,
  • numerical stability,
  • signal reconstruction,
  • Gibbs phenomenon
0% found this document useful (0 votes)
40 views6 pages

Fourier Series and FFT Analysis Lab

The document discusses digital signal processing concepts like the discrete Fourier transform (DFT) and fast Fourier transform (FFT). It contains code to generate and plot sample signals as well as their FFT. The key points are: 1) Increasing the number of points N in the FFT results in a smoother curve with more information. 2) A digital sinc function can act as a window to view a signal over particular time intervals. Using a longer length improves the window. 3) Aliasing occurs if the sampling frequency fs is less than twice the highest frequency component of the signal. Taking an FFT with more points N+N/5 reduces but does not eliminate aliasing.

Uploaded by

DannyRao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Topics covered

  • aliasing effect,
  • frequency components,
  • signal dynamics,
  • Fourier transform,
  • signal phase,
  • periodic signals,
  • time-domain signals,
  • numerical stability,
  • signal reconstruction,
  • Gibbs phenomenon

Lab 10

70)
clear all;
close all;
clc;
%% sawtooth
T=30;
t=-T:.0001:T;
sawtoothapp=zeros(1,length(t));
figure
for p=1:10
sawtoothapp=2/pi*(1)^(p+1)*1/p*sin(p*pi.*t/T)
+sawtoothapp;
plot(t,sawtoothapp);
hold on;
end
title('sawtooth aproximation of
various orders');
grid on;
%% square
clear all
T=30;
t=-T:.0001:T;
squareapp=zeros(1,length(t));
figure
for d=1:10
squareapp=4/pi*(1/(2*d1)*sin((2*d-1)*pi*t/T))+squareapp;
plot(t,squareapp);
hold on;
end
title('square aproximation of
various orders');
grid on;

Inference
Gibbs phenomenon increases as the
number of the terms of fft
increases
the increase of order makes the
oscillations about the actual
curve
smaller.

71)
L=5;N=10;
m=1:10;
x=zeros(1,10);
x(1:L-1)=1;
x(L:N)=0;
y=zeros(1,110);
for i=1:10
y(i*N:i*N+L-1)=1;
end
figure
stem(y)
N=250;k=-(N-1):N;w=2*pi*k/N;
Y=fft(y,2*N);
figure
stem(w,abs(fftshift(Y)));title('N=
10 and L=5');grid on;
N=20;L=5;
m=1:10;
x=zeros(1,10);
x(1:L-1)=1;
x(L:N)=0;
y=zeros(1,110);
for i=1:10
y(i*N:i*N+L-1)=1;
end
figure
stem(y)
N=250;k=-(N-1):N;w=2*pi*k/N;
Y=fft(y,2*N);
figure
stem(w,abs(fftshift(Y)));title('N=
20 and L=5');grid on;
N=40;L=5;
m=1:10;
x=zeros(1,10);
x(1:L-1)=1;
x(L:N)=0;
y=zeros(1,110);
for i=1:10
y(i*N:i*N+L-1)=1;
end
figure
stem(y)
N=250;k=-(N-1):N;w=2*pi*k/N;
Y=fft(y,2*N);
figure
stem(w,abs(fftshift(Y)));title('L=
5 and N=40');grid on;
L=7;N=60;
m=1:10;
x=zeros(1,10);
x(1:L-1)=1;
x(L:N)=0;
y=zeros(1,110);
for i=1:10
y(i*N:i*N+L-1)=1;
end

figure
stem(y)
N=250;k=-(N-1):N;w=2*pi*k/N;
Y=fft(y,2*N);
figure
stem(w,abs(fftshift(Y)));title('L=
7 and N=60');

Inference:Digital sinc function can be used


as a window for seeing the signal
in a particular time intervals.
If length is increased then the
sinc function becomes more proper.

72)

N=128;P=N/2;k=-P:P-1;w=2*pi*k/P;
x=[[0 1 2 3] zeros(1,125)];
X=fft(x,128);
figure
stem(w,abs(fftshift(X)));
N=256;P=N/2;k=-P:P-1;w=2*pi*k/P;
x=[[0 1 2 3] zeros(1,252)];
X=fft(x,256);
figure
stem(w,abs(fftshift(X)));
x=[0 1 2 3]
N=4;P=N/2;k=-P:P-1;w=2*pi*k/P;
X=fft(x,4);
figure
stem(w,abs(fftshift(X)));

Inference
If the number of points is
increased then the graph becomes
more closer so more information is
delivered.A higher values of
points gives more smooth curve

73)

N=20;
n=1:N;
%1
P=N/2;k=-P:P-1;w=2*pi*k/P;
f1=100;fs=2000;
x=5*cos(2*pi*100/2000*n+pi/2);
figure
stem(w,abs(fftshift(fft(x,N))));
P=(N+N/5)/2;k=-P:P-1;w=2*pi*k/P;
f1=100;fs=2000;
x=5*cos(2*pi*100/2000*n+pi/2);
figure
stem(w,abs(fftshift(fft(x,N+N/5)))
);
% b
N=5;
P=N/2;k=-P:P-1;w=2*pi*k/P;
f1=100;fs=2000;
x=5*cos(2*pi*100/500*n+pi/2)+6*sin
(2*pi*200/500*n);
figure
stem(w,abs(fftshift(fft(x,N))));
P=(N+N/5)/2;k=-P:P-1;w=2*pi*k/P;
f1=100;fs=2000;
x=5*cos(2*pi*100/2000*n+pi/2)+6*si
n(2*pi*200/2000*n);
figure
stem(w,abs(fftshift(fft(x,N+N/5)))
);
%c
P=N/2;k=-P:P-1;w=2*pi*k/P;
f1=100;fs=2000;
x=5*cos(2*pi*100/2000*n+pi/2)+6*si
n(2*pi*2100/2000*n);
figure
stem(w,abs(fftshift(fft(x,N))));
P=(N+N/5)/2;k=-P:P-1;w=2*pi*k/P;
f1=100;fs=2000;
x=5*cos(2*pi*100/2000*n+pi/2)+6*si
n(2*pi*2100/2000*n);
figure
stem(w,abs(fftshift(fft(x,N+N/5)))
);
Inference
The aliazing effect is observed if
N+N/5 point FFT is taken if
fs<fsignal then the component does
not come in spectrum

Common questions

Powered by AI

The document notes that aliasing effects are observed when using an N+N/5 point FFT if the sampling frequency (fs) is lower than the signal frequency (fsignal). In such cases, the higher frequency components do not appear correctly in the frequency spectrum due to insufficient sampling, leading to aliasing artifacts .

Increasing the number of points in the Fast Fourier Transform (FFT) enhances the resolution and smoothness of the frequency domain representation of a signal. The document highlights that with a higher number of FFT points, the graph approximating the signal becomes smoother, delivering more detailed information about the frequency components .

Altering signal parameters such as frequency and phase significantly impacts the resulting frequency spectrum. The document demonstrates that varying these parameters, particularly in example cases with changes in signal frequency relative to sampling frequency, leads to shifts and changes in spectral lines' amplitude and position. Adjustments in phase can affect the symmetry and magnitude alignment of these spectral components, thus impacting analysis accuracy when these adjustments are not accounted for .

The Gibbs phenomenon refers to oscillations that occur near the discontinuities of a signal when approximated using Fourier series. As more terms are added in the approximation, these oscillations become smaller and more localized around the discontinuity. However, the presence of these oscillations presents a challenge because they can distort the signal's representation, leading to inaccuracies in scenarios where precise signal replication is necessary .

The document uses the digital sinc function as a windowing technique to isolate certain time intervals in a signal for analysis. When the length of the sinc function is increased, it becomes more 'proper,' meaning it provides a cleaner and more defined view of the signal within those time intervals . This allows for better signal analysis by reducing leakage from adjacent components.

The process of signal approximation involves incrementally adding harmonic components to the base wave. For sawtooth waves, sine terms are added in an alternating pattern, while for square waves, odd sine harmonics are used. As more terms or higher orders are applied, the approximation becomes more accurate, closely mimicking the original waveform's sharp transitions . This is represented graphically by a sequence of approximations that more closely align with the target wave form.

The Gibbs phenomenon becomes more apparent with lower order Fourier series approximations as there are fewer terms to closely follow the discontinuities of the original signal. With increased order, the oscillations associated with the Gibbs phenomenon become sharper and confined, though they do not disappear entirely. This suggests a trade-off where increased terms improve the fit but accentuate the phenomena at the edges of discontinuities .

The document applies Fourier series to approximate signals such as sawtooth and square waves. This technique is based on summing up sine waves with varying frequencies and amplitudes to mimic the desired waveform. By increasing the number of terms or order of the Fourier series, the approximation accuracy improves. As noted, the higher the order of the approximation, the closer the oscillations around the actual curve, though possibly increasing the Gibbs phenomenon at high term numbers .

In the document, L represents the length of the part of the signal set to value 1, and N determines the spacing between repetitions of this pattern within the generated signal. These variables impact the spectral representation by affecting the frequency content visible in the FFT output. Specifically, increasing N while keeping L constant results in a spectrum with more distinct spectral lines, reflecting the periodic nature of the signal .

The document illustrates the use of FFT to analyze signals sampled at different frequencies by showing how different sampling frequencies affect the FFT outcome, particularly in relation to spectral representation and aliasing effects. If the sampling rate is lower than the Nyquist rate, aliasing artifacts can occur. Proper sampling at or above the Nyquist rate allows for effective distinction and accurate frequency representation without conflation of different signal components, as demonstrated when sample rates were varied while applying FFT .

You might also like