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!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# 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