Maria Posted July 10 Share Posted July 10 (edited) Hi, I'm having trouble with my formula. I have a signal I'm using that plugs into two different formulas, under two different conditions. When I execute the formula, the part of the new signal that fits the first condition is perfect, but when it tries to meet the second condition it's negative and way off scale. I know that my formula is continuous and works outside of SEEQ, so I'm not sure what I'm doing wrong. I've also tried inputting just the second condition into a separate formula, and it still doesn't give me the output I'm looking for. Is there something I'm missing? This is my formula: //formula for 0-70 $formula1 = 0.00000095467*$e325 ^4 - 0.000077805*$e325 ^3 + 0.0012485*$e325 ^2 + 0.078885*$e325 + 0.019834 $condition1 = $e325 <= 70 $result1 = $formula1.within($condition1) //formula for 70-100 $formula2 = -0.00022924*$e325 ^3 + 0.0545487*$e325 ^2 - 3.99555*$e325 + 98.9223 $condition2 = $e325 > 70 $result2 = $formula2.within($condition2) //combine formulas $combinedResult1 = $result1.splice($result2, $condition2) $combinedResult1.setUnits('') Edited July 24 by Maria Link to comment Share on other sites More sharing options...
Thorsten Vogt Posted July 10 Share Posted July 10 Hi Maria, as your source signal is measured in % you need to make it unitless. Otherwise the calculation will be affected by the units. 70%*70% = 49% in Seeq. So try: $signal = $e325.setunits('') //formula for 0-70 $formula1 = 0.00000095467*$signal ^4 - 0.000077805*$signal ^3 + 0.0012485*$signal ^2 + 0.078885*$signal + 0.019834 $condition1 = $signal <= 70 $result1 = $formula1.within($condition1) //formula for 70-100 $formula2 = -0.00022924*$signal ^3 + 0.0545487*$signal ^2 - 3.99555*$signal + 98.9223 $condition2 = $signal > 70 $result2 = $formula2.within($condition2) //combine formulas $combinedResult1 = $result1.splice($result2, $condition2) $combinedResult1.setUnits('') Regards, Thorsten 1 Link to comment Share on other sites More sharing options...
Maria Posted July 10 Author Share Posted July 10 Thank you!! I was trying to do it at the end, when I should've been doing it at the beginning. Lol. I really appreciate it 🙂 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now