"atan" function

9 views (last 30 days)
Dharmesh Nadhe
Dharmesh Nadhe on 15 Sep 2011
Hello,mycode is as follows: phi1= 0:1:360; beta=25; phi2= atand(cosd(beta)*tand(phi1)); error=phi2-phi1
all angle are in degrees. I am expecting "phi2" and "error" to be sinusoidal but what I am getting is, phi2 as saw tooth like function which increases till 90 degree and then drops to -90 and then again increases from -90 to 90 and it repeats. Can someone tell me how to get it as a sinusoidal wave?

Answers (1)

Wayne King
Wayne King on 15 Sep 2011
Dharmesh, since cosd(beta) with beta=25 is close to one, what you essentially are plotting is the inverse tangent of the tangent. The jump you see at 90 degrees is because the tangent becomes large and positive as theta approaches 90. The inverse tangent of that very large positive number (Inf) is 90. As soon as the angle goes past 90, call it 90+dtheta, the numerator in tangent is still a large positive number, but the denominator is a small negative number. That is the reason for the jump to -90. Over any interval where the "inverse" tangent actually behaves like a true inverse, you should get a line because phi1 is a line.
What makes you think the function should look smoother? Wayne
  1 Comment
Dharmesh Nadhe
Dharmesh Nadhe on 15 Sep 2011
Hello Wayne, my problem is about Hooke's joint. I am simulating behavior of two shafts jointed by simple hooke's joint. I want to see if I make a full rotation of input shaft how will the output shaft turn.beta is the inclination angle between input and output shaft. For hooke's joint, if phi1 is the input angle of rotation then, phi2 i.e. output angle of rotation can be obtained as
phi2= atand(cosd(beta)*tand(phi1));
the difference between input and output angle is:
error=phi2-phi1;
It is required that solution for "phi2" is continuous over the angle of interest. phi1 and phi2 both are functions of time. For hook's joint, this "error" increases with increasing inclination angle (beta) and it is sinusoidal in nature. Could you please suggest how can I get continuous behavior of phi2 ?

Sign in to comment.

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!