This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Find Maximum Value of Input

This example shows how to use the MinMax block to output the maximum value of two sine waves.

After running the full simulation, you can view the results in the Scope. Initially, the maximum value (orange line) tracks SineWave2. When the SineWave2 values turn negative, the maximum value begins tracking SineWave1. When the SineWave2 values become positive again, the maximum value resumes tracking SineWave2.

ans = 

                   tout: [57x1 double] 

     SimulationMetadata: [1x1 Simulink.SimulationMetadata] 
           ErrorMessage: [0x0 char]