Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

function Deg = RtoD (Rad) % RtoD will convert radians to degrees Deg = 360*Rad/(

ID: 3822695 • Letter: F

Question

function Deg = RtoD (Rad) % RtoD will convert radians to degrees Deg = 360*Rad/(2*pi); Rad = pi; %3.14159265 end T/F Variable names used in a function must be the same as the names used in the calling function as the arguments and returns. function Rad = DtoR(Deg) Rad = 2*pi*Deg/360; Deg = 0; %resetting the variable end T/F Function returns must be assigned to variables in the workspace (or calling function). SCRIPT T/F Values passed to a fund on argument must be variables from the workspace (or calling function). format bank disp ('Function and Scripts') Rad = pi/4 % 0.785398 Deg = RtoD (Rad) Angle = 0: pi/4: pi/2 Rad = RtoD (Angle) Deg = DtoR (RtoD (Angle)) help RtoD T/F Variables used o a script are saved to the workspace. RESPONSE TO SCRIPT If code produces an error, indicate 'error' on that line but then proceed to the remaining lines as if the error did not happen. Math can be approximated (pi/2 is ok and 1.57 is ok). Cross out the variable names that are not acceptable according to MatLab ThisTestlsReallyHard TheFirst4QuizesWereEasy Quiz_4 1_Test long_vanable_names_are_OK _X LOL&WTF; >> >> >> >> Name a function that can be used to assign a keyboard response to a variable. >> >> >> >> Name a function that can be used to solve problems with two independent variables. >>

Explanation / Answer

1..))

>>
>>
>>
>>
>>
>>
>> error: help: 'RtoD' is not documented


2..))
Variable Names used in a function must be the same as the names used in the calling function as the arguments and returns.
This statement is FALSE.
eg.

function myFun(a, b)
s = input(1);
disp("Demo");
end

x=5;
y=3;
myFun(x,y) //calling function myFun with different variable names

3..))
Function returns must be assigned to variables in the workspace(or calling function).
This statement is FALSE
eg.

function myFun()
something = 2*3*4
end

myFun() //this would still print 24. If you need to use value returned by a function, then only you must save it in a variable

4..))
Values passed to a function argument must be variables from the workspace(or calling function)
This statement is TRUE because function arguments has to be provided within the workspace.

5..))
Variables used in a script are saved to the workspace
This statement is TRUE because the variables are stored in volatile memory which is workspace, which means they will be erased as the program completes its execution.

6..))
Names which are not accepatble accroding to MatLab::

A valid variable name starts with a letter, followed by letters, digits, or underscores. So, Invalid Names are::

a. 1_Test
b. _X
c. LOL&WTF

7..)) x = input(prompt) //prompt contains some text which is displayed on the screen. It can be any text. x is the variable where user input is stored.