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
Algorithm for appex subfunction: The algorithm for appex subfunction is as shown:  Receives x & n as the input arguments.  Initializes a variable for running sum of t

Illustration of Matrix solutions: For illustration, consider the three equations below with 3unknowns x 1 ,x 2 , and x 3 : We can write this in the form Ax = b here A

Illustration of Image processing: This displays that there are 64 rows, or in another word, 64 colors, in this specific colormap. It also displays that the first five colors a

FOR Loop: The for loop, or the for statement, is used whenever it is essential to repeat statement(s) in the script or function, and whenever it is known ahead of time how man

Inverse of square matrix: The inverse is, hence the result of multiplying the scalar 1/D by each and every element in the preceding matrix. Note that this is not the matrix A,

Use of Nested if-else statements: By using the nested if-else to select from among the three possibilities, not all the conditions should be tested. In this situation, if x is

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 th

Technique is to create one element - vector: Technique is to create one element with the values from one structure, and use repmat to replicate it to the preferred size. Then,

function imread: The function imread can read an image file, for illustration a JPEG (.jpg) file. The function reads color images into a 3-dimensional matrix. >> myimage1

Example of image processing: The other illustration generates a 5 × 5 matrix of arbitrary integers in the range from 1 to the number of colors; the resultant image is as shown