Question: 1. Matching: a. Script _____ Shares its variables with the command window b. Function _____ Its variables are private by default _____ Has a header
1. Matching: a. Script _____ Shares its variables with the command window b. Function _____ Its variables are private by default _____ Has a header definition line defining the inputs and outputs 2. Which can be run from the Matlab command window: a. Script c. both a script and function b. Function d. neither can be run from the command window 3. A script often uses the input( Message ) function to prompt for input values. A script can display messages with the disp( arg ). The strcat( str1, str2 ) concatenates two strings. yourName = input( ?Enter your name: ? ); disp( strcat(?Hello ?, yourName ) ); Change the above code example to request and display your favorite color. 4. Write a template for a Matlab Function here: 5. The formula for the area of triangle is: A = b h. Where b = base length, and h = height. The function is used like this: area = areaTriangle( base, height ); Write a function named areaTriangle, to compute and return the area of a triangle given the base and height as inputs.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
