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
Reading from a File in a While Loop: Though in most languages the combination of a loop and an if statement would be essential to determine whether or not the elements in a ve

Example of Plotting from a Function: For illustration, the function can be called as shown below:      >> y = [1:2:9].^3      y =     1  27  125  343  729

Matrix definitions: As we know the matrix can be thought of as a table of values in which there are both rows and columns. The most common form of a matrix A (that is sometime

Illustration of Sound files: For illustration, the following script generates a subplot which shows the signals from chirp and from train, which is as shown in figure:

Illustration sorting vectors of structures: This function sorts the structures depend only on the price field. A more common function is shown next, that receives a string whi

printrectarea function: function call: printrectarea(length, width) function header: function printrectarea(len, wid)   In the function call, there are two argume

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

Vectors of Structures: In numerous applications, involving database applications, information generally would be stored in the vector of structures, instead of in individual s

Cross Product: The cross or outer product a × b of two vectors a and b is defined only whenever both a and b are the vectors in three-dimensional space, that means that they b

Referring to and Showing Cell Array Elements and Attributes: Just as with the other vectors, we can refer to individual elements of the cell arrays. The only difference is tha