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

The corresponding or associated yield mode with the smallest value, Mathcad15

SFares
12-Amethyst

The corresponding or associated yield mode with the smallest value, Mathcad15

Hello,

In mathcad-15,  Is there away i can get it to display yield mode (Z1m, Z1s, ZII, ZIIIm,ZIIIs...) that associated with or corresponding to the smallest value? For example, when ts=0.125, the smallest value is (198), so the yield mode (ZIIIs), and when ts=0.313, the yield mode corresponding to the smallest value (231) is (ZIV) and so on. 

Thank you,

Sam

SFares_0-1666449937225.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:SFares)

Please attach your worksheet as well!

 

To get the minimum value of the vector use the "min(..)" function.

If your goal is to get the variable name of the minimum value, thats not possible.

BUT you can get the index of the minimum value using the function "match".

You may setup a vector with the names in strings and using the value you get using match access and display the variable name that way. But you will have to create the vector with the names a strings manually yourself.

 

Something like this:

Werner_E_0-1666458467956.png

 

View solution in original post

4 REPLIES 4
Werner_E
24-Ruby V
(To:SFares)

Please attach your worksheet as well!

 

To get the minimum value of the vector use the "min(..)" function.

If your goal is to get the variable name of the minimum value, thats not possible.

BUT you can get the index of the minimum value using the function "match".

You may setup a vector with the names in strings and using the value you get using match access and display the variable name that way. But you will have to create the vector with the names a strings manually yourself.

 

Something like this:

Werner_E_0-1666458467956.png

 

SFares
12-Amethyst
(To:Werner_E)

Thanks a lot Werner!

I  followed the steps in your answer. The only question I have is the word" ORIGIN". I typed in the word "ORIGIN",at the end of  match function as shown below, but in your answer  the word "ORIGIN" appears as a subscript. Did i do it incorrectly. i can send you the sheet if you need it. Thanks again.

 

Sam

SFares_0-1666553292791.png

 

Werner_E
24-Ruby V
(To:SFares)

First of all - sorry, I notice just now that I mistakenly uses "max" in my screenshot while I should have used "min" instead. But as I can see you noticed that yourself anyway.

 

"match" returns a vector of index values even though it might be just one value. If the minimum value occurs twice or more in the vector, "match" would return a vector with all the corresponding indices. Because we need just one index (and I guess this situation probably will not occur in your application) I'd like to chose the first one. The number of the first entry in a vector is ORIGIN. By default ORIGIN has the value 0 but you could change it to any (integer value) you want. On obvious choice would be ORIGIN:=1.

As I wanted my suggestion to be independent on the way you may have set ORIGIN, I used this system variable instead of 0 (or 1).

And this has to be a vector index.

 

But it looks that you did all correctly. But because the name of your vector contains a literal subscript, the displayed expression simply look like ORIGIN is not subscripted but actually it is.

Something like

Werner_E_1-1666555381042.png

 

 

SFares
12-Amethyst
(To:Werner_E)

Thanks a lot for your detailed answer and efforts. I appreciate you, Werner!

 

Sam

Top Tags