Write a program that allows the user to input an angle between -4 and 4T, and ou
ID: 1842112 • Letter: W
Question
Write a program that allows the user to input an angle between -4 and 4T, and outputs the degree equivalent of the angle between 0° and 360° The program must use an i elseifelse block to check and implement the following conditions: If the angle is out of the range, an error message must be output, and the user must be allowed to try again If the angle is in the range but not between 0 and 2T, it must be changed to an equivalent value between 0 and 2T The angle must be converted to a degree value between 0 and 360Explanation / Answer
solution:
1)matlab code to convert radian angle to degree and within range for input between -4*pi<a<4*pi and output in the range of 0 to 360 degree.
matlab code is as follows:
clc;
clear all;
a=input('eneter value of input angle in radian');
if(0<=a<=4*pi)
b=2*pi;
r=rem(a,b)
r1=r*2*pi;
output=r1*(180/pi);
fprintf('output=%d',output);
else
if(-4*pi<=a<=0)
r2=rem(a,b)
r3=r2*2*pi;
output1=[360+r1*(180/pi)];
fprintf('output1=%d',output1);
else
fprintf('error');
end
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.