MathCAD Prime 3.0
ISSUE 1: I have a square matrix representing collected test data. The data near zero is due to measurement inaccuracy. Thus, I would like to run it through a "filter" to make it zero in a resultant matrix. In Excel, a simple =if(x>1,x,if(x<-1,x,0) is the way to evaluate a given value. I have tried putting IF statements in a resultant matrix to "filter" the values, but Prime 3.0 crashes every time. What is a work around or better way to do this?
ISSUE 2: Now after getting the above to work, I need a clever solution to comparing matricies. I would like to compare the resultant matrix from above to another same size square matrix relative to whether the value is zero, negative or positive. I am specfically looking for a sign change indicating a change in direction fo displacement between what is measured in a test and what is predicted in an FEA simulation. (For the curious: I am comparing the shape of a structure based on 3 points and their X, Y, Z positions.)
Thoughts?
Thanks ahead of time for any help you can provide.
Solved! Go to Solution.
Instead of using IF statements for #1, you could create a "mask" with Booleans. In the attached example, I look for values where the absolute value is greater than one. I can multiply the original vector with the mask to return only values that are greater than one. You can use the same trick for #2. Use the SIGN function to compare the signs of 'x' and 'y' and see when the two are different.
Instead of using IF statements for #1, you could create a "mask" with Booleans. In the attached example, I look for values where the absolute value is greater than one. I can multiply the original vector with the mask to return only values that are greater than one. You can use the same trick for #2. Use the SIGN function to compare the signs of 'x' and 'y' and see when the two are different.
That did the trick, thank you much, sir!
David
You're better off posting a worksheet with sample data showing what you want to achieve.
Im not quite sure about your second issue. Which value are you observing (for being +, - or 0)?
You may simple calculate the difference
Looking for sign change you have to deal with 8 cases you have to define what the outcome should be.
+/+ and -/- obviously should yield a 0, as no sign change happened
likewise +/- and -/+ yield -1 resp. +1
but what about 0/+, 0/-, +/0, -/0 ?
E.g. 0/- is not necessarily an indicator of a sign change from plus to minus - that depends on the next value.
See if the attched file helps at least for the first issue.