How to extract state values of function slewrate() / Get Upper state values bimodal waveform

2 views (last 30 days)
Hello,
The builtin function slewrate() indicates in a plot the upper state and the lower state levels. However, I could not find a parameter on how to extract those values. I mean, if the plot shows those values, it should be possible to get them as a value..
Or maybe there is another function/method ? I have a square waveform with overshoot (both on the high and low side) and want to get the settled values from top and bottom.

Answers (1)

Sumukh
Sumukh on 31 Jul 2024
Hi Jemp.
The “slewrate” function has few name-value pair arguments that can be passed into it, as per the following documentation:
One such name-value pair is for passing “StateLevels” argument. If nothing is passed here, the slewrate function uses states estimated by the “statelevels” function, which uses a histogram method to estimate the state levels of given bilevel waveform. You can try out the following line of code to get the state levels:
levels = statelevels(y) % y should be declared before running this.
The levels” variable is a 1x2 vector that has the lower and upper state levels of given bilevel waveform in variable “y”. Please refer to the following documentation for further understanding:
I hope this solves the issue.

Community Treasure Hunt

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

Start Hunting!