Skip to main content
15-Moonstone
April 26, 2014
Solved

Matlab vs. MathCad and Solve Blocks

  • April 26, 2014
  • 3 replies
  • 9339 views

I am trying to translate some Matlab programs into MathCad. My question is highlighted below and the worksheet is attached. Thanks in advance for any help.

Best answer by RichardJ

big_grin.gif

3 replies

25-Diamond I
April 26, 2014

You have to use the "Insert image" button to insert pictures in the context of a discussion. Just copy and paste doesn't work.

EDIT: Its not clear to me what you are trying to do at the end of your file, but minimize() can be used standalone without a solve block, too, if you don't have to provide any constraints. Not sure, though, if its really the function you need.

15-Moonstone
April 26, 2014

Yep, that dawned on me. Here it is...

Function+to+calculate+the+minimum+distance+from+the+front+rim+in+the+relevant+time+interval.jpg

19-Tanzanite
April 26, 2014

You refer to the function fminbnd, but no such function exists in your worksheet. What is this function?

15-Moonstone
April 26, 2014

I guess I was not very clear. fminbnd is the Matlab function. fminbad (func, a, b) finds the minimum of func in the interval [a,b] (Note: funct depends on a single variable). I thought Minimize in MathCad was similar but had to be used with a solve block. Werner pointed out that it can be used alone, but now I see that it is for multi-variable functions. I guess I am looking for something like the MathCad function root, but for the minimum of a single variable function.

25-Diamond I
April 26, 2014

Which function do you want to minimize and in what interval?

A multivariable function would work with a single variable function as well, but I fear you want to minimize a function with more than one argument, vary only one of them and hold the others constant.

I remember that minimize made troubles when used in a program and it also cannot be turned into a function (as if I guesss right would be necessary here). It will also not work with locally defined functions.

You may write a brute force fminbnd(func,a,b) yourself but it would lack of precison and probably be rather slow.