Complex mathematical functions
Chances are you’re going to be doing much more than simple addition, subtraction, multiplication, and division in your PLC programs. Most likely (especially for motion control), you’re going to utilize some more advanced mathematical functions, such as square roots, exponents, and trigonometric functions. So, in this section, we’re going to explore those functions and how to use them in a PLC program.
Square root function
Outside of addition, subtraction, multiplication, and division, square roots are one of the most common math functions there are. Many basic geometry and trigonometric operations that PLC programmers will use in their day-to-day lives will depend on the square root of a number. The best way to explore this function is to use it in an example.
As usual, the first thing you should do is set up the program variables. As we progress through this section, we’re going to add more variables and functions...