Function call - modular program, MATLAB in Engineering

Function call:

In the function call, not any arguments are passed so there are no input arguments in the function header. The function returns an output argument, therefore that is stored in one variable.

calcarea function:

function call: area = calcarea(radius);

function header: function area = calcarea(rad)

In the function call, only one argument is passed in the parentheses, therefore there is one input argument in the function header. The function returns an output argument and hence that is stored in one variable.

printarea function:

function call: printarea(radius,area)

function header: function printarea(rad,area)

In the function call, there are two arguments passed, hence there are two input arguments in the function header. The function does not return anything, therefore the call to the function is a statement by itself; it is not in an assignment or output statement.

Obviously, the readradius function must actually error-check the user's input.

 

Posted Date: 10/19/2012 8:18:24 AM | Location : United States







Related Discussions:- Function call - modular program, Assignment Help, Ask Question on Function call - modular program, Get Answer, Expert's Help, Function call - modular program Discussions

Write discussion on Function call - modular program
Your posts are moderated
Related Questions
Plotting from a Function: The following function creates a Figure Window as shown in figure, which shows various types of plots for similar y vector. The vector is passed as a

Patch function - graphics objects: The patch function is used to generate a patch graphics object, which is made from 2-dimensional polygons. The patch is defined by its verti

Preallocating a Vector: There are necessarily two programming techniques that can be used to simulate the cumsum function. One technique is to begin with an empty vector and c

Appending variables to the Mat-File: Appending to the file adds to what has been saved in a file, and is accomplished by using the -append option. For illustration, supposing

Data structures: The Data structures are variables which store more than one value. In order to made sense to store more than one value in a variable, the values must in some

Gauss, Gauss-Jordan elimination: For 2 × 2 systems of equations, there are well-defined, easy solution techniques. Though, for the larger systems of equations, finding solutio

Illustration of symbolic variable: When, on the other hand, z is a symbolic variable to start with, quotes are not required around the expression, and the words are automatica

Execution steps: Whenever the program is executed, the steps below will take place: The script calcandprintarea starts executing. The calcandprintarea calls the readr

Solving 2 × 2 systems of equations: However this may be easy in a MATLAB, in normal finding solutions to the systems of equations is not. The systems which are 2 × 2 are, thou

Simplification Functions: There are numerous functions which work with expressions, and simplify the terms. Not all the expressions can be simplified, but the simplify functio