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

## Export Minimum of a time dependent equation  6-Contributor

## Export Minimum of a time dependent equation

Dear helpers,

I have a time dependent equation in x and y and I would like to export the local minimum of that equation dependent on time.

My idea was to set a time step first and then export the minimum for every time step in an (excel-)table (because I need to plot the results in excel for my diploma thesis). Therefor I tried to program a loop but it didn't work.

Is there anyone who can help me out? Is there another way to solve this?

I am thankful for every advice.

PS: the equation is w(x,y,t) at the end of the file. I set t=1 to show the results at this time in the plot.

1 ACCEPTED SOLUTION

Accepted Solutions  24-Ruby V
(To:fkcom)

1) Find attached an animation which clearly shows that the minimum is always at (0.25/0.2).

2) If you insist in calculating the minimum with minimize instead of trusting that its always at the same position, you can turn minimize into a function the same way as I had shown here: https://community.ptc.com/t5/PTC-Mathcad/Using-minimize-for-a-function-which-depends-on-parameters/m-p/564989/highlight/true#M181699

See the screenshot at the end of this post

3) Your way of writing every single value with its own WRITEEXCEL command to the file would not work the way you did. Instead of writing "Blatt1!Ci" you would have to use concat("Blatt1!C",num2str(i))

But its far more efficient if you create a vector with all the values first and then write this vector to an Excel file in one go (again - see screenshot). File in MC15 format attached

6 REPLIES 6  24-Ruby II
(To:fkcom)

Try to use "WRITEEXCEL (...)" function.   6-Contributor

I already tried this function (see attached file).

I think my problem is that I'm not that experienced in programming.

So if anyone could tell me what is the best way to determine the minimum for every time step and export these to an excel-file that would be great!

thank you.  24-Ruby V
(To:fkcom)

Looks like you are only interested in the area  0<=x<=0.5 and 0<=y<=0.4.

It seems to me that the minimum in this area always and independent of t is at (0.25 / 0.2). At least for 0<t<2.

Are you sure about the guess values you provide for x and y? The position (1.25 /1) you get with those values is way outside the portion of the surface which your plot shows. The minimum itself will not change, though.

So for a list of the minimal values for different values of t you could simply evaluate w(0.25,0.2,t).  23-Emerald I
(To:fkcom)

There is a gradient function in Mathcad 15, "cntrl shift G" that could be used in a solve block to locate the minimum of each w(x,y,t) for each time.  You could then build a matrix of (t,x,y,minumum) for exporting to EXCEL  24-Ruby V
(To:fkcom)

1) Find attached an animation which clearly shows that the minimum is always at (0.25/0.2).

2) If you insist in calculating the minimum with minimize instead of trusting that its always at the same position, you can turn minimize into a function the same way as I had shown here: https://community.ptc.com/t5/PTC-Mathcad/Using-minimize-for-a-function-which-depends-on-parameters/m-p/564989/highlight/true#M181699

See the screenshot at the end of this post

3) Your way of writing every single value with its own WRITEEXCEL command to the file would not work the way you did. Instead of writing "Blatt1!Ci" you would have to use concat("Blatt1!C",num2str(i))

But its far more efficient if you create a vector with all the values first and then write this vector to an Excel file in one go (again - see screenshot). File in MC15 format attached  6-Contributor
(To:Werner_E)

Thank you very much, Werner. That helped me a lot.

You are totally right, the minimum is at the same position independent of t. I defined the variables Xi and Eta before which set the force acting point. So the position of the minimum depends on how one sets Xi and Eta. The solution in your screenshots is exactly what I needed.

Really appreciate that. Announcements