Help function, MATLAB in Statistics

Help function:

Function is computing the two values, there are two output arguments in the function header (i.e., area & circum), that are placed in the square brackets [ ]. And hence, somewhere in the body of the function, the values have to be assigned to both. As the function is returning two values, it is significant to capture and store them in separate variables when the function is called, merely as both the number of rows and the number of columns would be captured from the size function. In this situation, the first value returned, that is the area of the circle, is stored in the variable a and the second value returned is stored in the variable c.

>> [a c] = areacirc(4)

a =

   50.2655

c =

   25.1327

 

If this is not completed, only the first value returned is maintained; in this situation, the area will be:

 

>> disp(areacirc(4))

   50.2655

 

Note that in capturing the values the order matter. In this situation, the function returns at first the area & then next the circumference of the circle. The order in which the values are assigned to the output arguments within the function, though, does not matter.

The help function represents the comment listed under the function header:

>> help areacirc

  This function computes the area and

  the circumference of a circle

 

Posted Date: 10/19/2012 6:23:51 AM | Location : United States







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

Write discussion on Help function
Your posts are moderated
Related Questions
The IF Statement: The if statement selects whether or not the other statement, or group of statements, is executed. The common form of the if statement is as shown below: i

Generic code for Reading from Files: The generic code to complete this is as shown below:   fid = fopen('filename'); if fid == -1    disp('File open not suc

Program of Persistent variables: The program below elaborates this. The script calls a function func1 that initializes a variable count to 0, then increment it, and print the

Indexing: The Indexing is an alternate to sort a vector. With indexing, the vector is left in its original order. An index vector is used to point values in the original vecto

Vectorizing: In most of the cases in MATLAB, loops are not essential. As MATLAB is written specifically to work with the vectors and matrices, most operations can be completed

Working of Editor and debugger: Editor/Debugger, or commands can be typed from Command Window. For illustration, the dbstop command below will set a breakpoint in the fifth li

Example of sorting strings: To sort a cell array of strings, also the sort function is used. The illustration is as follows, >> engcellnames = {'Chemical','Mechanical',.

Illustration of Input in a for loop: In this illustration, the loop variable iv iterates through the values 1 through 3, therefore the action is repeated three times. The acti

fscanf function - file function: The fscanf reads matrix variable mat columnwise from the file specified by fid. The 'format' involves conversion characters much similar to th

Statistics There are numerous statistical analyses which can be executed on data sets. In MATLAB software, the statistical functions are in the data analysis help topic known a