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
Example to change the line width from the default: For illustration, to change the line width from the default of 0.5 to 1.5: >> set(hl,'LineWidth',1.5) As long as the

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

Finding a sting - function findstr: The function findstr receives two strings as input arguments. It finds all the occurrences of shorter string contained by the longer, and r

readlenwid function: function call: [length, width] = readlenwid; function header: function [l,w] = readlenwid In the function call, not any argument is passed; henc

Illustration of finding a sting: Let's enlarge this, and write a script which creates a vector of strings which are phrases. The outcome is not suppressed so that the string

Illustration of Gauss elimination: For illustration, for a 2 × 2 system, an augmented matrix be: Then, the EROs is applied to obtain the augmented matrix into an upper

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


Use of While loop: Here is an illustration of calling the function, passing 5000 for the value of the input argument high. >> factgthigh(5000) ans = 5040 The itera

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