> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/power_fftscope.md).

# power\_fftscope

The **power\_fftscope function** computes Fourier analysis of simulation data signals.

## Syntax

{% code lineNumbers="true" %}

```matlab
FFTDATA = power_fftscope(ScopeData) 
FFTDATA = power_fftscope(FFTDATA) 
power_fftscope(ScopeData) 
power_fftscope(FFTDATA)
```

{% endcode %}

## Description

**FFTDATA** = power\_fftscope(ScopeData) returns the FFT results for the signal saved in the ScopeData structure-with-time.

**FFTDATA** = power\_fftscope(FFTDATA) uses the FFTDATA structure as a template variable to modify analysis settings and signal selection, and to perform FFT analysis.

The **power\_fftscope** function ignores any user-defined FFTDATA fields that are not listed in the FFTDATA structure.

**power\_fftscope(ScopeData)** plots the FFT analysis results for the last simulation cycle of the signal saved in the ScopeData variable.

**power\_fftscope(FFTDATA)** plots the FFT analysis results for the signal options specified in the FFTDATA structure.

## Input Arguments

**ScopeData** — Signal you want to perform Fourier analysis on Structure with time (default) :Signal you want to perform the Fourier analysis on, specified as a structure with time.

**FFTDATA** — Signal options Structure (default): Signal options, specified as a structure with these fields:

<table data-header-hidden><thead><tr><th width="250.33343505859375"></th><th></th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>Description</strong></td></tr><tr><td>time</td><td>The time vector of the simulation data signal saved in the ScopeData variable.</td></tr><tr><td>signals</td><td>The signals saved in the ScopeData variable.</td></tr><tr><td>blockName</td><td>The name of the Scope block associated with the ScopeDatavariable.</td></tr><tr><td>input</td><td>The input signal of the selected simulation data variable.</td></tr><tr><td>signal</td><td>The index of the selected input signal specified by the Inputfield.</td></tr><tr><td>startTime</td><td>The start time of the FFT window.</td></tr><tr><td>cycles</td><td>The number of cycles of the FFT window.</td></tr><tr><td>fundamental</td><td>The fundamental frequency of the analyzed signal.</td></tr><tr><td>maxFrequency</td><td>The maximum frequency evaluated by the FFT analysis.</td></tr><tr><td>THDmaxFrequency</td><td>The maximum frequency for the total harmonic distortion (THD) calculation. Set the value to inf to calculate the THD at the Nyquist frequency.</td></tr><tr><td>FFTdata</td><td>The analyzed signal (FFT window data).</td></tr><tr><td>THDbase</td><td>The base used to compute the THD. Set to fund to normalize the THD with respect to fundamental value. Set the THDbase to DC to normalize the THD with respect to the DC component value.</td></tr><tr><td>freqAxis</td><td><p>The type of frequency axis of the FFT analysis plot. Set to hertz to display the frequency axis in hertz.</p><p>Set to harmonicorder to display the frequency axis in harmonic orders.</p></td></tr><tr><td>mag</td><td>The computed magnitude of FFT.</td></tr><tr><td>phase</td><td>The computed phase of FFT.</td></tr><tr><td>freq</td><td>The frequency vector.</td></tr><tr><td>THD</td><td>The computed THD for the analyzed signal. The THD calculation includes all the inter-harmonics of the selected input signal.</td></tr><tr><td>samplingTime</td><td>The sampling time of the selected input signal.</td></tr><tr><td>samplePerCycle</td><td>The number of samples per cycle of the selected input signal.</td></tr><tr><td>DCcomponent</td><td>The DC component value of the selected input signal.</td></tr><tr><td>magFundamental</td><td>The fundamental component value of the selected input signal.</td></tr></tbody></table>

## Output Arguments

**FFTDATA** — FFT results for signal Structure: FFT results for the signal saved in the ScopeData argument, returned as a structure with these fields:

<table data-header-hidden><thead><tr><th width="249.88897705078125"></th><th></th></tr></thead><tbody><tr><td><strong>Field</strong></td><td><strong>Description</strong></td></tr><tr><td>time</td><td>The time vector of the simulation data signal saved in the ScopeData variable.</td></tr><tr><td>signals</td><td>The signals saved in the ScopeData variable.</td></tr><tr><td>blockName</td><td>The name of the Scope block associated with the ScopeData variable.</td></tr><tr><td>input</td><td>The input signal of the selected simulation data variable.</td></tr><tr><td>signal</td><td>The index of the selected input signal specified by the Input field.</td></tr><tr><td>startTime</td><td>The start time of the FFT window.</td></tr><tr><td>cycles</td><td>The number of cycles of the FFT window.</td></tr><tr><td>fundamental</td><td>The fundamental frequency of the analyzed signal.</td></tr><tr><td>maxFrequency</td><td>The maximum frequency evaluated by the FFT analysis.</td></tr><tr><td>THDmaxFrequency</td><td><p>The maximum frequency for the total harmonic distortion (THD) calculation.</p><p>Set the value to inf to calculate the THD at the Nyquist frequency.</p></td></tr><tr><td>FFTdata</td><td>The analyzed signal (FFT window data).</td></tr><tr><td>THDbase</td><td><p>The base used to compute the THD. Set to <code>fund</code> to normalize the THD with respect to fundamental value.</p><p>Set the THDbase to DC to normalize the THD with respect to the DC component value.</p></td></tr><tr><td>freqAxis</td><td><p>The type of frequency axis of the FFT analysis plot.</p><p>Set to hertz to display the frequency axis in hertz. Set to harmonicorder to display the frequency axis in harmonic orders.</p></td></tr><tr><td>mag</td><td>The computed magnitude of FFT.</td></tr><tr><td>phase</td><td>The computed phase of FFT.</td></tr><tr><td>freq</td><td>The frequency vector.</td></tr><tr><td>THD</td><td><p>The computed THD for the analyzed signal.</p><p>The THD calculation includes all the inter-harmonics of the selected input signal.</p></td></tr><tr><td>samplingTime</td><td>The sampling time of the selected input signal.</td></tr><tr><td>samplePerCycle</td><td>The number of samples per cycle of the selected input signal.</td></tr><tr><td>DCcomponent</td><td>The DC component value of the selected input signal.</td></tr><tr><td>magFundamental</td><td>The fundamental component value of the selected input signal.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/smart-power-simulation-software-sps/blocks-functions-tools/control-and-measurements/power_fftscope.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
