How to find value of X when Y reaches maximum value

4 views (last 30 days)
I am new to MATLAB Simulink, I want output as the value of X when Y reaches maximum.
Y is a calculated value from an equation and is a function of X
RAHUL YADAV on 19 Aug 2020
Thanks for the reply...
problem solved using Leonardo's approach

Sign in to comment.

Accepted Answer

maiaL on 18 Aug 2020
Not sure what kind of output you want, but one way would be to get the derivative of your y(x) function. When it's "zero", it's at a maximum or minimum. I added quotes to "zero" because it's not going to be zero due to the time step of the solver. In the above example I'm getting the absolute of the derivative and when it's <= 0.01, I get the x value.

Sign in to comment.

More Answers (1)

Sara Boznik
Sara Boznik on 18 Aug 2020


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by