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

Translate the entire conversation x

Set vector element to zero, after two vectors subtraction

SFares
14-Alexandrite

Set vector element to zero, after two vectors subtraction

Hello,

 

After subtracting two vectors, how do i set the element value to zero if it is negative? P9 sheet is attached.

 

 

SFares_1-1753896333104.png

Thanks,

Sam

ACCEPTED SOLUTION

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

In case you need it more often to limit a value or a vector of values between two limits, you may use a small utility function.

Werner_E_2-1753900087490.png

 

In your case you have to use vectorization and use the limits zero and infinity.

Werner_E_1-1753899829564.png

In case you use units, don't forget to apply the appropriate units to the limits as well (even if its infinity).

 

Of course you always can use programming (even thought it may be considered overkill here

Werner_E_4-1753900326176.png

And even though I don't like this kind of approach, what you can do with for loops most often also could be done using range variables:

Werner_E_5-1753900557716.png

 

Prime 9 sheet attached

 

 

 

 

View solution in original post

4 REPLIES 4
AlanStevens
19-Tanzanite
(To:SFares)

Here's one way:

 

Pos.png

SFares
14-Alexandrite
(To:AlanStevens)

Thank you, Alan!

Werner_E
25-Diamond I
(To:SFares)

In case you need it more often to limit a value or a vector of values between two limits, you may use a small utility function.

Werner_E_2-1753900087490.png

 

In your case you have to use vectorization and use the limits zero and infinity.

Werner_E_1-1753899829564.png

In case you use units, don't forget to apply the appropriate units to the limits as well (even if its infinity).

 

Of course you always can use programming (even thought it may be considered overkill here

Werner_E_4-1753900326176.png

And even though I don't like this kind of approach, what you can do with for loops most often also could be done using range variables:

Werner_E_5-1753900557716.png

 

Prime 9 sheet attached

 

 

 

 

SFares
14-Alexandrite
(To:Werner_E)

Thank you for the different alternatives. Werner!

I used your solution.

Announcements

Top Tags