Math Question

Greetings everyone,

I'm trying to use the AB CPT instruction to linearize a non-linear output of a transmitter. I haven't entered extensive equations in a CPT instruction before. I keep getting in trouble with my synatax within the CPT instruction. I have an idea it's my use of parens that is incorrect. Here is what I need to enter in the CPT instruction:

y=342.73x^4-3484.5x^3+13284x^2-22576x+14497

Where x=n7:3 and y=n7:1

TIA,

Greg
 
Forgot this...

This is the syntax I'm using:

((342.73*N7:3**4)-(3484.5*N7:3**3)+(13284*N7:3**2)-(22576*N7:3)+(14497))



What is incorrect?

TIA,

Greg
 
Or this. Not sur why you are putting the ansewer in a integer. I use a floating point. I did this offline, it did verify though.


CPT.jpg


With a value of one in N7:3. A pretty big number
0r I got the equation wrong
BigNumber.jpg
 
I can't remember which processors support the CPT instruction, but does the processor you have support floating point math? While the end result might be a reasonable value for an integer your intermediate values are going to be pretty big.

The thing might be getting unhappy with the parentheses around your constant at the end. I've never done that so I don't know what it will do.

Other than that everything else looks right to me from a syntax standpoint. Peter Nachtwey would say stay away from the exponent functions in this case because of calculation efficiency but that's another thing entirely.

Keith
 
Mickey, your equation and Greg's equation are different from what I can see. I take it that Greg only wants N7:3 taken to a power. Your equation multiplies and the product is take to an exponent.


Unless I am misinterpretting what Greg wants to do.

Keith
 
kamenges said:
Mickey, your equation and Greg's equation are different from what I can see. I take it that Greg only wants N7:3 taken to a power. Your equation multiplies and the product is take to an exponent.


Unless I am misinterpretting what Greg wants to do.

Keith

Your probably right.

Update:
CPT2.jpg
 

Similar Topics

... I followed a link dealing with Permutations and Combinations, and learnt a (to me) startling fact ! 0 * 0 = 0 agreed ? 0 * 0 * 0 = 0 agreed...
12
Replies
4,265
Views
See attached pic Why is R02451 reading 0 before the Real_to_Int conversion? It is reading 23 after, which is what it should read.
8
Replies
2,686
Views
Im using Wonderware Intouch machine edition v8.0. Question: How does the Math Worksheet/Task scripting work? I have the following expression...
3
Replies
3,133
Views
Hi Group, I'm the new owner of an AB MicroLogix 1400 processor and have been trying to decide the best way to de-pressurize a compressed air tank...
8
Replies
2,781
Views
🤷 I have a small cattle herd and am trying to create a feed estimate calculator. Each beast will eat about 3% of its body weight each day...
4
Replies
3,230
Views
Top