Modular programs, MATLAB in Engineering

Modular programs:

In a modular program, the answer is broken down into modules, and each is executed as a function. The script is usually known as the main program.

In order to elaborate the concept, we will use the very easy illustration of computing the area of a circle. In the next part, a very long and more realistic illustration will be given. For this illustration, there are three steps in the algorithm to compute the area of a circle:

  •  Get the input (that is the radius)
  •  Compute the area
  •  Show the results

 

 

Posted Date: 10/19/2012 8:12:46 AM | Location : United States







Related Discussions:- Modular programs, Assignment Help, Ask Question on Modular programs, Get Answer, Expert's Help, Modular programs Discussions

Write discussion on Modular programs
Your posts are moderated
Related Questions
Example of modular program: In a modular program, there would be one main script which calls three separate functions to complete these tasks: A function to prompt an us

Illustration of Subfunctions: This is an illustration of running this program: >> rectarea Please enter the length: 6 Please enter the width: 3 For a rectan

Function used in binary search: The function below implements this binary search algorithm. It receives two arguments: the sorted vector and a key (on the other hand, the func

Variable Scope: The scope of any of variable is the workspace in which it is valid. The workspace generated in the Command Window is known as the base workspace. As we know

Creating a cell array: The other method of creating a cell array is easy to assign values to particular array elements and build it up element by element. Though, as explained

Algorithm for expfn function: The algorithm for expfn function is as shown:  receives the value of x as the input argument.  Prints the value of exp(x).  assigns a

Displaying expressions: The good-looking function will show such expressions by using exponents; for illustration, >> b = sym('x^2') b = x^2 >> pretty(b)

Reduced Row Echelon Form: The Gauss Jordan technique results in a diagonal form; for illustration, for a 3 × 3 system: The Reduced Row Echelon Forms take this one step

Displaying the cell arrays: There are several techniques of displaying the cell arrays. The celldisp function shows all elements of the cell array:   >> celldisp(cellro

Example of Interpolation and extrapolation: The MATLAB has a function to do this, known as polyfit. The function polyfit finds the coefficients of the polynomial of the partic