Colon operator, MATLAB Programming

The Colon Operator:

If the values in the vector are regularly spaced, the colon operator is used to iterate through these values. For illustration, 1:5 results in all the integers from 1 to 5:

>> vec = 1:5

vec =

1  2  3  4  5

Note that in this situation, the brackets [ ] are not essential to define the vector.

With the colon operator, a step value can also be identified with the other colon, in the form (first: step: last). For illustration, to generate a vector with all the integers from 1 to 9 in steps of 2:

>> nv = 1:2:9

nv =

1  3  5  7  9


Posted Date: 10/18/2012 4:14:03 AM | Location : United States

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

Write discussion on Colon operator
Your posts are moderated
Related Questions
Compare results/performance with tridiagonal Gaussian elimination solver for the problem arising from -y''=f   on (0,1) with y(0)=0=y(1). You may also need to use sparse storage an

How to make EMG analysis by Matlab?

i want matlab code for DFB Equiliser and the output between tha number of iterations vs MSE

Q. An expression for a sawtooth wave over the internal 0 ≤ t ≤ T0 is given by f(t) = At/T0. The student is encouraged to check the Fourier coefficients to be a 0 = A/2, an = 0 for

Type logical: The type logical is used to store the true/false values. If any variables have been formed in the Command Window, they can be seen at the Workspace Window. In

Types: Each and every expression, or variable, has a type related with it. The MATLAB supports numerous types of values that are known as classes. A class is necessarily a com

how to model a diode in matlab given data

wite a function that will take In a simplex an an associated and return the nitial feasible solution of the tableau x as a column vector as well as the objective the objective fun

Various commands for get the help: There are various commands which can serve as an introduction to MATLAB and allow you to get the help: info will show contact informatio