• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. Getting the absolute max value using the calculator

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 126
  • Views 12133
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Getting the absolute max value using the calculator

KasperM
KasperM over 2 years ago

I am trying to find the global Y peak value of a graph. Basically the ymax but than also with the posibility of it being negative.
Using ymax(abs(expression)) will not cut it as I'd like to preserve the sign.

Is there a simple way of doing this?

With kind regards.

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    Without having to write a custom function, you could do it this way:

    value(VT("/out") xmax(abs(VT("/out"))))

    xmax gives the x-value where the ymax occurs.

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to Andrew Beckett

    Dear Kaspar,

    KasperM said:

    I am trying to find the global Y peak value of a graph. Basically the ymax but than also with the posibility of it being negative.
    Using ymax(abs(expression)) will not cut it as I'd like to preserve the sign.

    Is there a simple way of doing this?

    I happened to think of this last night after I first read your post. The sign is preserved by including the second term. I think this might accomplish your objective as well as Andews's suggestion.

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to ShawnLogan

    Dear Kaspar,

    As I looked at my expression, I realized I made an error! Sorry! I think the correct expression should read:

    In this fashion if the maximum value is positive and the minimum value is negative and the positive value exceeds the negative value in absolute value, the term:

    will be +1., If the minimum value is negative and exceeds the maximum value in absolute value, the value of ymax(expression) + ymin(expression) will be less than 0 and the added term will be -1.

    Hence, I believe this should retain the sign of your maximum absolute value.

    Sorry for my initial error Kaspar!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to ShawnLogan

    Dear Kaspar,

    As I looked at my expression, I realized I made an error! Sorry! I think the correct expression should read:

    In this fashion if the maximum value is positive and the minimum value is negative and the positive value exceeds the negative value in absolute value, the term:

    will be +1., If the minimum value is negative and exceeds the maximum value in absolute value, the value of ymax(expression) + ymin(expression) will be less than 0 and the added term will be -1.

    Hence, I believe this should retain the sign of your maximum absolute value.

    Sorry for my initial error Kaspar!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to ShawnLogan

    Hi Shawn,

    A small nit-pick on your proposed solution (which is a neat idea, although does involve more processing of waveforms than mine); it won't behave properly if the ymax and ymin are equal (but with different signs) - such as with an ideal sine wave centred around 0; then you'll have a divide by zero error.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 2 years ago in reply to Andrew Beckett

    Dear Andrew,

    Andrew Beckett said:
    A small nit-pick on your proposed solution (which is a neat idea, although does involve more processing of waveforms than mine); it won't behave properly if the ymax and ymin are equal

    You are absolutely correct!  I did realize the potential flaw when I thought of it.  I was going to include it in writing, but thought it might be obvious. And, yes, you are also correct it will require more processing. I thought I would just throw out the idea if it might spark some interest. Thank you, as always, for reading my post and including your comment and the caveat explicitly.

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information