Jump to content

Recommended Posts

  • MVP 2023
Posted

Use the floating point math to implement a Taylor series-

image.png.3909630d8df3209f93b536e63f819b75.png

I'd run the equation a few times in a spreadsheet to see how far n has to increment to get the accuracy you're looking for.

Joe T.

  • Like 1
Posted
10 minutes ago, Joe Tauser said:

Use the floating point math to implement a Taylor series-

image.png.3909630d8df3209f93b536e63f819b75.png

I'd run the equation a few times in a spreadsheet to see how far n has to increment to get the accuracy you're looking for.

Joe T.

Thanks Joe. That will return radians? I can use the degrees function to go back?

  • MVP 2023
Posted

Yes, it will be radians.  1 radian = 57.2958 degrees.

It's actually not as hard as it looks.  Many moons ago, I needed to calculate the cosine of an angle in a Siemens S7-200, which does not have floating point.  Some obscure neuron fired in my brain and remembered studying Taylor series in school as the way to determine the values of trigonometric functions.  

Here's how to get cosine:
image.png.16a7323ce671b203df20d277fbe62dc8.png

I used double integers (MLs or VD32 in SiemensSpeak) with a virtual decimal place of 4 and only had to take it out to k=4 to get a good value.  As you can see, if you go past that the numbers get really tiny and don't affect the value much.

If you expand the arcsin Tayor series out to n=4 the front part of the equation becomes just number that some nimble fingering on your calculator can arrive at and you can punch that in as a constant to multiply the x^(2n+1) amount by. 

It's no fun being an engineer if you don't stretch your brain sometimes.

Joe T.

Posted

I over complicated this entire thing. So for anyone else trying to get degrees from the hypotenuse and the opposite side this is how I did it. The first subtraction block was done to bring my vertex to 0

ladder1.jpg

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.