> 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/miscellaneous-functions/misc.-or-env-peak.md).

# Misc. | ENV PEAK

## **PEAK OF ENVELOPE – \[ENVPEAK]**

Outputs the peak value of the input (peak of envelope). The function displays output only if the next sample of the input is greater than or equal to the previous peak identified.

## **CATEGORY**

Miscellaneous

![](https://content.gitbook.com/content/fwfLeQP2Iaoefor0ZUNi/blobs/TSZBvozHuSYaAwJcQd9n/image2018%209%2024_12%2056%2022.png)

## **DESCRIPTION**

Outputs the peak value of the input (peak of the envelope). The function displays output only if the next sample of the input is greater than or equal to the previous peak identified.

## **RESULT VARIABLES AND PARAMETERS**

<table data-header-hidden><thead><tr><th width="103.5999755859375"></th><th width="200.4000244140625"></th></tr></thead><tbody><tr><td><strong>Result</strong></td><td>Peak value of the input</td></tr><tr><td><strong>Signal</strong></td><td>Input</td></tr></tbody></table>

## **SYNTAX**

**res**=envpeak(input)

## **CHARACTERISTICS**

Data type support

Double Floating point

## **EXAMPLE**

Consider a sinusoidal signal with a periodicity of 16.67 ms (60 Hz) as input. Over a duration of 0.1 seconds, there will be 6 peaks. The function will have exactly 7 output points corresponding to 6 peaks and one for the first sample. That is because the function will detect only a positive peak and display only if the detected peak is either greater or equal to the previous peak value.

In the below example, though the output seems to be continuous, it is only because an inherent linear interpolation algorithm is used between two successive peaks. For the same reason, there is no output graph visible after the last peak (around 0.095 second).

![](https://content.gitbook.com/content/fwfLeQP2Iaoefor0ZUNi/blobs/tNndlm5FDe1i7LujFZHL/image2018%209%2024_12%2059%2028.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/miscellaneous-functions/misc.-or-env-peak.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.
