Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
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.
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!
Solved! Go to Solution.
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)
Please post a worksheet containing the function and multiple inputs.
Mike
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)
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
Thank you for your efforts. Using the vectorize operator works fine.
The following illustration shows the solution as intended.
Also works in M15 using Vectorise.
Mike
Another method just for fun. Not that I would recommend this one.
Mike
Mike Armstrong wrote:
Also works in M15 using Vectorise.
Mike
But, But, But ... That means that if you ever have to use vector x again, you'll have to type the vectorize operator *again* <splutter> This flies in the face of every principle of maximal laziness that I know of !!!!
Bateman's Famous "The Man Who Was Asked To Apply An Operator Twice Rather Than Write A Function To Avoid Doing So"
Stuart
Only offered options because I was bored.
I personally wouldn't solve as I suggested unless it was end of my worksheet.
Mike