### Question

How to calculate magnitude and phase angle of a discrete Fourier Transform function using HyperGraph?

### Answer

Time domain and frequency domain are two ways to analyze signals. Time domain analysis considers the amplitude of a signal over a period of time, however, it may contain important information that is difficult or even impossible to detect when the analysis is performed only in the time domain.

There are some very good reasons for working in the frequency domain:

- Some complicated operations in the time domain become simple in the frequency domain, for example convolution in the time domain becomes a simple multiplication in the frequency domain.
- The relationship between the excitation and the response of a structure is often more easily understood in the frequency domain.
- An analysis in frequency domain could provide a lot of convenience and a better insight of the system where one wants to know at which frequency(range) the system has an issue, and at which frequencies the contributors are located.

Typical frequency domain analysis types of OptiStruct: Modal FRF Analysis, Random Response Analysis, ERP/Infinite Element Acoustic Analysis

Fourier analysis is the representation of periodic waveforms in terms of trigonometric functions, enabling the decomposition of continuous functions into its essential sine waves. HyperGraph provides dftmag/dftphase, fftmag/fftphase to perform Fourier Transform. dftmag has a higher order of complexity than fftmag, so it's slower and more accurate.

A simple example was created to show the process. Please open the *.tpl file in HyperGraph to review the details.

**Description of the example:**

- Windows 1,2,3: 3 curves of sinusoidal response
- Windows 4: summation of the above 3 curves.
- Windows 5 and 6: the magnitude and phase were calculated respectively. The original phase angle is measured in radians. In this example it's converted to degrees.

**dftmag**: Magnitude of a discrete Fourier Transform (dFT) function.**dftphase**: Phase angle of a discrete Fourier Transform (dFT) function.

**ebook**authored by Roberta Varela & Lorenzo Moretti.

**Please note:**before performing a Fourier Transformation, one should prepare the signal properly. The preparation work includes scaling, detrending, spike detectoin/removal, resampling etc. which is critical to ensure that the true behavior of the system can be reflected.