> 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/scopeview/use-functions/spectral-analysis-functions/spectral-analysis-or-crospec.md).

# Spectral Analysis | CROSPEC

## CROSS SPECTRAL DENSITY – \[CROSPEC]

Outputs the cross-spectral density of two signals.

## CATEGORY

Spectral analysis

![](https://content.gitbook.com/content/fwfLeQP2Iaoefor0ZUNi/blobs/LH4V1g2ljyspiPWII8fv/image2018%209%2024_15%2013%2013.png)

## DESCRIPTION

Outputs the cross-spectral density by doing a Fast Fourier transform on both signals and returning cross-spectral density.

## RESULT VARIABLES AND PARAMETERS

<table data-header-hidden><thead><tr><th width="175.81817626953125"></th><th></th></tr></thead><tbody><tr><td><strong>Magnitude (m)</strong></td><td>Cross-spectral density magnitude</td></tr><tr><td><strong>Phase_Angle (a)</strong></td><td>Cross-spectral density phase</td></tr><tr><td><strong>Signal_X</strong></td><td>First signal to use for the cross-spectral density</td></tr><tr><td><strong>Signal_Y</strong></td><td>Second signal to use for the cross-spectral density</td></tr><tr><td><strong>Window</strong></td><td>Type of windowing applied to the analyzed samples. Refer to the beginning of Spectral analysis category to have a short description. [0: Rectangular,1: Hanning, 2: Hamming, 3: Blackman]</td></tr></tbody></table>

## SYNTAX

**\[m,a]**=crospec(x,y,2)

## CHARACTERISTICS

Data type support

Double Floating point

## EXAMPLE

Here are the results of the cross-spectral density of:

x=sin(pi\*2\*15\*t)

y=sin(pi\*2\*15\*t+90\*360/(pi\*2))+sin(pi\*2\*28\*t+90\*360/(pi\*2))

![](https://content.gitbook.com/content/fwfLeQP2Iaoefor0ZUNi/blobs/PlOWgqjeVcsZ3cLCxB3h/image2018%209%2024_15%2013%2038.png)


---

# 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/scopeview/use-functions/spectral-analysis-functions/spectral-analysis-or-crospec.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.
