0% found this document useful (0 votes)
5 views3 pages

AssignmentDocument

This assignment requires writing a C program to compute the Discrete Fourier Transform (DFT) of a signal from a provided dataset and to smooth the signal using a moving average before recalculating the DFT. The assignment is divided into three parts: calculating the DFT for the original and smoothed signals, generating plots of their transforms, and analyzing the results. Students must handle complex values in the DFT and explain the implications of their findings regarding the signals and their spectra.

Uploaded by

hayatkk10407
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

AssignmentDocument

This assignment requires writing a C program to compute the Discrete Fourier Transform (DFT) of a signal from a provided dataset and to smooth the signal using a moving average before recalculating the DFT. The assignment is divided into three parts: calculating the DFT for the original and smoothed signals, generating plots of their transforms, and analyzing the results. Students must handle complex values in the DFT and explain the implications of their findings regarding the signals and their spectra.

Uploaded by

hayatkk10407
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Signals and Systems Analysis

Assignment on the Discrete Fourier Transform

March 11, 2025

Summary

This assignment involves writing a computer program in the C program-


ming language. It will read in a file of the values of a signal and then
calculate its Discrete Fourier Transform (DFT). The program will then
‘smooth out’ the signal using a moving average and then re-calculate the
transform.
The data for your work comes from the spreadsheet ’Signals2025’ that
comes with this document. The spreadsheet generates 5 columns of
numbers; the first is the time value and the next four are the values of
four distinct signals at that time. You should copy and paste this data
into a plain text file to use as your input. The symbols x1 to x4 will denote
the four signals in your data.
In the following questions, the number N1 will denote the number of
values in each signal (that is, each column of numbers) in your data.
The ‘length of the record’ is denoted by N2 .
There are three parts to the assignment, be sure and answer the ques-
tions from all three parts.

1
Part 1

Your program should carry out the following steps.

1. Read in the list of values in your input file, noting the number N1 ,
the number of values in each signal in your data. The following steps
will be set out for x1 but must be done for each of the four signals
you have, x1 to x4 .

2. For the first signal in your data, x1 [n], calculate the DFT of the signal
x1 [n] for N2 = N1 . The result of your calculation should be a list of
values in a file. Explain in your program comments or elsewhere in
your submission how your program handles the complex values of
the transform x
c1 [k].

3. Repeat this process for length of record N2 = 2N1 .

Part 2

A second signal y1 is constructed as the 5-point moving average of the


signal x1 . Using N1 as the length of the signal, this is defined as follows:

• y1 [0] = x1 [0]

• y1 [1] = 1
x1 [0] + x1 [1] ,

2

• y1 [2] = 1
x1 [0] + x1 [1] + x1 [2] ,

3

• y1 [3] = 1
x1 [0] + x1 [1] + x1 [2] + x1 [3] ,

4

• For all n > 3 and n < N1 − 4: y1 [n] = 1


5 x1 [n − 2] + x1 [n − 1] + x1 [n] +
x1 [n + 1] + x1 [n + 2] .


• y1 [N1 − 4] = 1

4 x1 [N1 − 4] + x1 [N1 − 3] + x1 [N1 − 2] + x1 [N1 − 1]

• y1 [N1 − 3] = 1

3 x1 [N1 − 3] + x1 [N1 − 2] + x1 [N1 − 1]
• y1 [N1 − 2] = 1

2 x1 [N1 − 2] + x1 [N1 − 1]

• y1 [N1 − 1] = x1 [N1 − 1].

Your program should now carry out the following steps.

1. Generate the signal y1 from signal x1 .

2. Calculate the DFT of the signal y1 [n] for both values of the length of
the record N2 .

Part 3

You should now have data files with the signal x1 , the smoothed signal
y1 and the transforms of both signals for lengths of record N1 and 2N1 .

1. Draw a plot of the real and complex components of transform x


c1 [k].

2. Draw plots of |c
x1 [k]| and arg(c
x1 [k]), where |z| represents the modulus
of the complex number z and arg(z) is the argument of z. So if r = |z|
and A = arg(z) then z = rejA .

3. Explain the difference in your output when N2 = 2N1 .

4. Draw a plot of the real and complex components of transform yb1 [k].

5. Draw a plot of |yb1 [k]| and arg(yb1 [k]).

6. Explain what the transform you have calculated is telling you about
the signal x1 . Consider the meaning of the Fourier Transform and
its link to the idea of a spectrum in answering this question.

7. Comment on the similarities and differences in the graphs of |c


x1 [k]|
and |yb1 [k]|, drawing out a comparison of what they are telling you
about the signal and its smoothed version.

You might also like