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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Compare multiple vectors with a single value?

dsochor
10-Marble

Compare multiple vectors with a single value?

The attached worksheet attempts to find the maximum of each line of two vectors and a single value. What needs to be done to make this work?

It's modeled after the answer from the following prior discussion: Minimize between vector and a single value

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:dsochor)

Here is the file with Richards suggestion of how to use your function along with an alternative approach using a function which returns simple the maximum of 3 scalars and then is called vectorized with the vectors as arguments. This function could also be used in the way you tried using the range i.

Regards

Werner

View solution in original post

4 REPLIES 4
RichardJ
19-Tanzanite
(To:dsochor)

Your for loop starts at 0 and you have ORIGIN set to 1.

Thank you Richard; that is a good catch. No dice though.

RichardJ
19-Tanzanite
(To:dsochor)

You should be passing vectors to the function. If you pass, for example, l.dh[i,2, you are passing a scalar value

Werner_E
25-Diamond I
(To:dsochor)

Here is the file with Richards suggestion of how to use your function along with an alternative approach using a function which returns simple the maximum of 3 scalars and then is called vectorized with the vectors as arguments. This function could also be used in the way you tried using the range i.

Regards

Werner

Announcements

Top Tags