cancel
Showing results for
Did you mean:
cancel
Showing results 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

1-Newbie

## Help with Minimize optimization

Hello,

Attached is a short sheet with a Minimize function. I'm getting a "variable undefined" error.

Can anyone help?

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:JasonC)

The problem is the inline evaluation after minimize() in combination with different units. This would force Mathcad to display a vector with two values of different dimensions and unfortunately thats something Mathcad is not capable of.

You have to assign the result of minimize a 2x1 vector of two variables ro make it work:

3 REPLIES 3
24-Ruby V
(To:JasonC)

The problem is the inline evaluation after minimize() in combination with different units. This would force Mathcad to display a vector with two values of different dimensions and unfortunately thats something Mathcad is not capable of.

You have to assign the result of minimize a 2x1 vector of two variables ro make it work:

1-Newbie
(To:Werner_E)

Thanks!!

Now for the next step, I want to plot Vscc (which Minimize finds), vs. Vor.

Attached is my attempt to create a function that calls Minimize... it doesn't work.

24-Ruby V
(To:JasonC)

You can't use a solve block in a program. You'd rather turn the solve block into a function.

As this function would have to return a vector with two different dimensions (which is not possible im Mathcad) we have to get rid of the units here. Furthermore turning minimize and maximize into a function with a variable argument of the objective function can be quite tricky. The order of the arguments matters and in the objective function the parameter to be varied (V.or) must be the first argument - have no clue why.

Guess the attached does what you wanted.

Announcements
Top Tags