"atan" function
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponses (1)
Wayne King
le 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
Voir également
Catégories
En savoir plus sur Assembly dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!