Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
math.h
Posted: Mon Feb 27, 2012 11:49 am
Hello! How could I return sinus value from a given angle. I'm using 18f2520 and I wanna utilize with trigonometric functions. Some sample codes would be very useful. Excuse my bad english.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Mon Feb 27, 2012 1:56 pm
Read the description of the sin() function in math.h. It's right there:
Code:
////////////////////////////////////////////////////////////////////////////
// float sin(float x)
////////////////////////////////////////////////////////////////////////////
// Description : returns the sine value of the angle x, which is in radians
You give the sin() function an angle (in Radians, not degrees) and you get
back the sine value (as a floating point number).
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
Posted: Mon Feb 27, 2012 2:24 pm
oh I see! My mistake was that I put angle with degree dimension. I test the formula: result = sin((3.14*angle_degree)/180) and it works. Thank you very much.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum