Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with basic Excel trig error. 1

Status
Not open for further replies.

theradarguy

Aerospace
Apr 27, 2006
3
Hi guys,
I just found this form and I need some help. I am fairly savy in Excel and am using it to verify(troubleshoot) an application in another program I am developing. Since the error repeats in both I am suspecting ME!
Here is the chore. Set two non zero coordinate points like x1, y1 and x2, y2. Use any units. Find slope(angle) using ATAN and the length using Pythagorean formula. Now find the X and Y components using SIN & COS. Add them to x1 and y1.
You should get the coordinates of x2 and y2. I am not and that is my problem. For my example:
x1 = 100
y1 = 100
x2 = 200
y2 = 200

If I do the math I get:
x2 = 199.7020561
y2 = 199.7020561

This is nearly 1.5 % off. I am doing this in the spreadsheet so ther is no real code involved.

I am not imune to making stupid errors.
Thanks,
Russ
 
Replies continue below

Recommended for you

Your hypotenuse (Pythagorean) calculation is rounding to an integer somewhere. The hypotenuse length for your given points is exactly 100*(2^0.5), or somewhere around 141.4214. If you truncate the decimal portion and perform your sine and cosine functions on a value of 141 you will end up with the result you posted.
 
I found the problem. I had a round() function in that I did not detect early enough. Thanks for viewing. Like I said I am not imune to stupid errors.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor