"atan" function
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Wayne King
2011-9-15
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
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!