Illustration of script documentation, MATLAB Programming

Illustration of script Documentation:

For illustration, the script to compute the area of a circle could be modified to have comments:

2281_Illustration of script Documentation.png

The first comment at the starting of the script explains what the script does. Then, throughout the script, comments explain various parts of the script (not generally a comment for every line, though!). The Comments don't affect what a script does; therefore the output from this script would be similar as for the earlier version.

The help command in a MATLAB works with scripts as well as with the built-in functions. The initial block of comments (defined as adjacent lines at the starting) will be displayed. For illustration, for script1b:

>> help script1b

This program evaluates the area of a circle

The reason that a blank line was inserted in the script between the first two comments is that otherwise both would have been interpreted as one adjacent comment, and both lines would have been displayed with help. The very first comment line is known as the H1 line; it is what the function look for searches through.

Posted Date: 10/18/2012 5:45:53 AM | Location : United States







Related Discussions:- Illustration of script documentation, Assignment Help, Ask Question on Illustration of script documentation, Get Answer, Expert's Help, Illustration of script documentation Discussions

Write discussion on Illustration of script documentation
Your posts are moderated
Related Questions
logical operators: The logical operators are as shown below: All the logical operators operate on Boolean or logical operands. The not operator is a unary operator; wh

Illustration of modifying the matrix elements: If a single index is used with the matrix, the MATLAB unwinds the matrix column by column. For illustration, for the matrix intm

how to find absolute value of a number

illustration of for loop: illustration, to print a column of numbers from 1 to 5: for i = 1:5 fprintf('%d\n',i) end   This loop can be entered in the Command Wi

Documentation: It is very important that all the scripts be documented well, so that the people can understand what the script does and how it accomplishes that. One way of do

Solution by using pdepe function functionpdex1 m = 0; x = linspace(0,1,100); t = linspace(0,0.2,10);   sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t); % Ext

Introduction to Matlab: The MATLAB is a graphical and mathematical software package; it has graphical, numerical and programming capabilities. It has built-in functions to do

Water flow varies with water pressure. Two studies were made and two equations were developed: Parabolic fit:  F = 59.60180 + 3.77965 P - 0.01536 P 2       P

need help in my accounts help

Example of Linear indexing: For illustration, the following substitutes the whole second row with values from a vector  The whole row or column could also be changed : >> m