11 Replies Latest reply: Mar 17, 2013 6:25 AM by VladimirN. RSS

    Comparing Two RV Arrays and Outputting Character Strings

    ptc-5000285 Copper

      So I'm very new to mathcad prime and I'm trying to compare resultant numbers from computing with range variables. I was hoping someone could show me how to figure out what I'm trying to accomplish.

       

      Example (simplified):

      I've defined two range variables

       

      A:=220,320..420

      B:=840,640...440

       

      then applying some math with the RVs

      C(A):=A/2

      D(B):=B/4

       

      I would then like to compare the first value of C to the three values in D and determine if it is greater than or less then the D value and then output an array with Yes if greater, or No is less than. Then repeat this with the second and third values in C respectively.

       

      I'm thing something like this...

       

      i=0

      j=0

      for i=1:3

           for j=1:3

                if C(i)>D(j)

                    E(i+j) = "Yes"       %I'd like the ouput to be a one dimensional array/vector and not a two dimensional matrix

                else

                    E(i+j) = "No"

           end

      end

       

      The red boxes are the two variables I'd like to compare, and display if alpha is greater than tau in a coulmn matrix/array.

      Untitled.png