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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started