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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to find Maximum Value of Sine function over a range of time.

mesipa
1-Newbie

How to find Maximum Value of Sine function over a range of time.

Hello,

I have a function like this:

Eqn.bmp

The Plot of this function looks like this:

Graph.bmp

I want to find the maximum value of this function within time range of t= 0 sec to 0.1 sec. If I put initial guess of 0.03 s the maximize function gives the maximum value within the cycle at 0.03s. How do I find maximum of different cycles within a range. Any help is appreciated very much. I have attached my work sheet here.

16 REPLIES 16
wayne
3-Visitor
(To:mesipa)

Here is one way

mesipa
1-Newbie
(To:wayne)

Thank you very much for your valuable response

Fred_Kohlhepp
23-Emerald I
(To:mesipa)

Once again, brute force!

I Thank you very very much, This one is much more shorter than previous. Appreciate it.

wayne
3-Visitor
(To:mesipa)

Fred's is nice, I agree.

But it's not actually shorter. You must manually step to find the peaks, or you might miss one. Also, If you want the max absolute value, then you must add to the program and have even more steps.

If all you want is the maximum positive value, then creating a vector of values,v and using the max(v) is as short as you get and does not require any manual intervention.

But, depends how much information and how automated you want.

MikeArmstrong
5-Regular Member
(To:wayne)

Both nice example, very neat indeed.

Mike

Fred,

How can I get the value of time,x corresponding to the maximum value z.

Fred_Kohlhepp
23-Emerald I
(To:mesipa)

Like Wayne did

Thanks!!!

MikeArmstrong
5-Regular Member
(To:mesipa)

I'm sorry, I had to get involved. I've used a pre-defined function in my sheet, but hey, that's why they were written.

Clipboard01.jpg

Mike

Slightly improved.

Clipboard01.jpg

Mike

How is that slightly improved? By using a non-standard function? Paste that into a clean worksheet and report what the answers are.

If you want a vector, build a vector.

And where do you define "step"?

How is that slightly improved? By using a non-standard function? Paste that into a clean worksheet and report what the answers are.

It's slightly improved on my own version, I'm not comparing it to your's or Wayne's.

Yes, non standard functions have been written because of Mathcad's flaws. I do not make functions universal, never. If someone wants to paste the function into a clean worksheet, they will also have to paste the predefined vec function. No big deal IMO.

If you want a vector, build a vector.

And where do you define "step"?

Step is defined above the function as shown in the Mathcad sheet I posted.

Mike

wayne
3-Visitor
(To:mesipa)

I spent a little more time and extended to find all of the roots and the local extrema between the roots, and the locations. But once the functions have been defined, only have two functions, one for zeros and one for local extrema.

MikeArmstrong
5-Regular Member
(To:wayne)

Here is a worksheet which has been passed in the forum several times.

Mike

Thanks Mike.

Top Tags