Matlab solution for DR and RD. Urgent help ! - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Matlab solution for DR and RD. Urgent help !

Posts: 1Member
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

clear,clc

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)
else
if selection = 2 then
output = RD(x)
end
end