Example of modular program, MATLAB in Engineering

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 user and read in the radius
  • A function to compute the area of a circle
  • A function to show the results

As both the scripts and functions are stored in M-files, there would be four individual M-files together for this program; one M-file script and three M-file functions, as shown below:

1855_Example of modular program.png

650_Example of modular program1.png

411_Example of modular program2.png

 

Posted Date: 10/19/2012 8:15:29 AM | Location : United States







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

Write discussion on Example of modular program
Your posts are moderated
Related Questions
Use of built-in colormaps: MATLAB has built-in colormaps, it is also possible to generate others by using combinations of any colors. For illustration, the following generates

Replacement : Replace a row by adding it to (or subtract from it) a multiple of the other row. For a given row ri, this is written as   ri  - srj →  ri Note that when r

Anonymous Functions: The anonymous function is a very easy, one-line function. The benefit of an anonymous function is that it does not have to be stored in an M-file. This ca

Passing Structures to Functions: The whole structure can be passed to a function, or separate fields can be passed. For illustration, here are the two distinct versions of a f


Program of passing arguments to functions: This was an illustration of a function which did not receive any input arguments nor did it return any output arguments; it easily a

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

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


Storing Strings in Cell Arrays: The one good application of a cell array is to store strings of various lengths. As cell arrays can store various types of values in the elemen