Hi i need to write Matlab solution for the function DR that ask for angle in degrees and computes the equivalent radians, and another function RD that ask for angle in radians compute the equivalent degrees. And my function should be able to accept both scalar and matrix input.
The script should keep running until no number is provided to convert.
[The function[b] isempty[/b] will be useful here]
This what i write on Matlab
degrees = radians * 180/pi
radians = degrees * pi/180
function output = DR(x)
%This function changes degrees to radians
output = x*pi/180;
function output = RD(x)
%This function changes radians to degrees
output = x*180/pi;
selection = input ('Enter 1 for Degrees to Radians or Enter 2 for Radians to Degrees')
output = input (' Enter the number for calculation ' )
if selection = 1 then
output = DR(x)
if selection = 2 then
output = RD(x)
It can't work at all !! Can someone please help me?
0 · ·