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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Discretize a continuous function to get its max value?

JBlackhole
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

Make sure t is a vector not a range variable:

 

max.JPG

Alan

 

View solution in original post

4 REPLIES 4

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:

 

https://support.ptc.com/help/mathcad/r6.0/en/index.html#page/PTC_Mathcad_Help%2Fabout_solve_block_functions.html%23wwID0EYDC5

 

https://support.ptc.com/help/mathcad/r6.0/en/index.html#page/PTC_Mathcad_Help%2Fexample_optimizing_a_function.html%23wwID0E4EJJB

 

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

 

Stuart 

Make sure t is a vector not a range variable:

 

max.JPG

Alan

 

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.

 

2020 04 09 A.png

 

2020 04 09 B.png

 

Stuart

 Thanks for the info. 

Top Tags