cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

16-Pearl

## Discretize a continuous function to get its max value?

I can't remember hence the silly question. If one has a continuous function (in my case of time) and one wants to only return the max (absolute) value of the function (range 0..tend), does one needs to discretize the function?

a example

y(t):t^2  wit t = 0..5

max(y(t)) does not return 25

1 ACCEPTED SOLUTION

Accepted Solutions
17-Peridot
(To:JBlackhole)

Make sure t is a vector not a range variable:

Alan

4 REPLIES 4
23-Emerald II
(To:JBlackhole)

I don't think you do if you've got Premium Prime (ie, not Express).  You can use a solve block or maximize function, as described in:

If it's an analytic function, then you could also either try using symbolic differentiation to find the maximum (1st and 2nd derivatives)

Stuart

17-Peridot
(To:JBlackhole)

Make sure t is a vector not a range variable:

Alan

23-Emerald II
(To:JBlackhole)

You need to be careful how many points you evaluate a function over when looking for its maximum within a given range.

If you don't have enough points, you will not likely get the prize of picking the right maximum or even seeing most of them.

Here's the difference between 0..5 and 0,0.01..5.  Quite different beasts.

Stuart

16-Pearl
(To:StuartBruff)

Thanks for the info.

Announcements
Top Tags