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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Could you give me a method to restrick vector's values?

jlee-2
1-Newbie

Could you give me a method to restrick vector's values?

35.PNG

I want "omega" to restrict 12.1rpm.

So I tried such as a upper picture.

But I got error. I can't understand why I got error.

could you help me?

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:jlee-2)

You may use a small auxiliary function whch you then call vectorized:

1.png

View solution in original post

11 REPLIES 11
Werner_E
24-Ruby V
(To:jlee-2)

You may use a small auxiliary function whch you then call vectorized:

1.png

Oh Thank you very much.

But I wonder why I got error when I tried

Werner_E
24-Ruby V
(To:jlee-2)

You can't compare a vector to a scalar. In fact - you can, but the result will be a vector consisting of zeros and ones which is invalid as condition in the if function.

1.png

36.PNG

But It is ok.

I can't understand why

Werner_E
24-Ruby V
(To:jlee-2)

I don't see what your function P returns but if it works then I guess its a scalar value and not a vector.

okay I see.

Finally I have a question.

Is it possible following?

limit(x,X,Y):=if(Y<x<X , x, X, Y)

StuartBruff
23-Emerald II
(To:jlee-2)

jinsuk Lee wrote:

okay I see.

Finally I have a question.

Is it possible following?

limit(x,X,Y):=if(Y<x<X , x, X, Y)

Not quite, because the if function only takes 3 arguments and you have 4 argument. You also need to define the condition for when to choose X or Y. There are a few ways you could do it. For example,

limit(x,X,Y):=if(Y<x<X,x,if(x>Y,X,Y)

or

limit(x,X,Y):=if(x>Y, (if x<X,x,X), Y)

I'd probably put Y before X in the function's arugment list, as it's conventional to put the lower limit first.

I think the Limit function I posted will do what you want, though.

Stuart

thank you very much~

StuartBruff
23-Emerald II
(To:jlee-2)

No problem.

Stuart

StuartBruff
23-Emerald II
(To:Werner_E)

Here's another I sometimes use (in M15 not Prime, and short enought that it's probably quicker and more convenient to type the function rather than convert it to Prime) ...

collab+-+14+12+22+limiting+matrix+values+01.JPG

Stuart

Thankyou for helping

Top Tags