Skip to main content
3-Newcomer
September 10, 2015
Solved

Evaluate function containing min-function for vector

  • September 10, 2015
  • 3 replies
  • 2742 views

Dear Community,

I'd like to evaluate a user-defined function for multiple input arguments using a vector. The problem is that my function contains the min-function and the user-defined function is evaluated only for the smallest argument. The following illustration shows my (simplified) function to calculate the force distribution in a concrete plate.

2015-09-10_135349.png

Is it possible to adapt the function, so that a vector can be used as input argument, or do I have to use a range variable?

Thank you for your efforts!

Best answer by StuartBruff

Use the vectorize operator; first select the whole expression on the right hand side and then apply vectorize from the Operator tab in the ribbon.

Stuart

(I assume none of the other variables are vectors? If they are a different approach might be needed)

3 replies

1-Visitor
September 10, 2015

Please post a worksheet containing the function and multiple inputs. 

Mike

23-Emerald V
September 10, 2015

Use the vectorize operator; first select the whole expression on the right hand side and then apply vectorize from the Operator tab in the ribbon.

Stuart

(I assume none of the other variables are vectors? If they are a different approach might be needed)

23-Emerald V
September 10, 2015

StuartBruff wrote:

Use the vectorize operator; first select the whole expression on the right hand side and then apply vectorize from the Operator tab in the ribbon.

Stuart

(I assume none of the other variables are vectors? If they are a different approach might be needed)

Actually, it's not quite as straightforward as that - I'd forgotten that min behaves differently under vectorize to most functions.  However, there are several ways of dealing with the situation:

Stuart

Bruggi3-NewcomerAuthor
3-Newcomer
September 10, 2015

Thank you for your efforts. Using the vectorize operator works fine.

The following illustration shows the solution as intended.

2015-09-10_165204.png

1-Visitor
September 10, 2015

Also works in M15 using Vectorise.

Mike

1-Visitor
September 10, 2015

Another method just for fun. Not that I would recommend this one.

Mike