Illustration of a built-in function, MATLAB Programming

Illustration of a built-in function:

The length function is an illustration of a built-in function which computes a single value; it returns the length of a vector. As an illustration, length (vec) is an expression; it shows the number of elements in the vector vec. This expression can be used in the Command Window or in a script. Usually, the value returned from this expression may be assigned to the variable:

>> vec = 1:3:10;

>> lv = length(vec)

lv =

4

Alternatively, the length of vector could be printed

>> fprintf('The length of the vector is %d\n', length(vec))

The length of the vector is 4

Posted Date: 10/18/2012 7:12:55 AM | Location : United States







Related Discussions:- Illustration of a built-in function, Assignment Help, Ask Question on Illustration of a built-in function, Get Answer, Expert's Help, Illustration of a built-in function Discussions

Write discussion on Illustration of a built-in function
Your posts are moderated
Related Questions
Creating Matrix Variables: Creating a matrix variable is actually just a generalization of creating a row and column vector variables. That is, the values within the row are s

For the 66kV subtransmission network shown below, calculate the following, using a MATLAB Simulink Power System Blockset model: 1. Three phase, phase-to-phase and phase-to-earth

Show (turn in) similar output images as in part 2 for each of your new images (there is only 1 connected component in this case). Write three functions which compute the moments, c

Variable names: Variable names are an example of the identifier names. The rules for identifier names are as shown below: (A)The name should begin with a letter of the alph

Printing Vectors and Matrices: For vector, if the conversion character and newline character are in the format string, it will print in a column in spite of of whether the vec

Call to length function: The call to length function consists of the name of the function, followed by an argument in the parentheses. This function takes the argument, and re

Generates sin or cos wave using plot functions: The script generates an x vector; iterating through all the values from 0 to 2*π in steps of 2*π /40 gives sufficient points to

Scripts with Input and output: Placing all this together, we can implement the algorithm from the starting of this section. The following script computes and prints the area o

Mathematical operation: For numerical operands, the use of such operators is clear-cut. For illustration, 3 >> 3 ans = 1 >> 9 ans = 0 Though, in the Wo

Non-Ideal Gas (van der Waals equation):  An equation of state for a non-ideal which is commonly used is the van der Waals equation for 1 mol of gas  P = (R*T)/(V-b) - a/(V^2)