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
Using numerical techniques, plot the intensity distribution for LP 01 and LP 11 modes. Vary the value of V (reduce it to 1.5) and plot several of the intensity plots (of LP 01 )

how to write a program to determine the day of the week. using GUI.

A. Introduction The project consists of two parts. In the first part you are asked to perform some preliminary calculation and plotting, and to write the introduction for your

Vectors and Matrices: The Vectors and matrices are used to store sets of values, all of which are similar type. A vector can either be a column vector or a row vector. The mat


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

Function definitions: There are various ways to organize the scripts and functions, but for now every function which we write will be stored in a separate M-file, that is why

This problem is intended to demonstrate some problems that can arise from the finite precision of numerical calculations performed with computers.  We will do this by approximating

Given the following image, 1 2 1 1 2 0 0 1 5 1 0 1

Solve the optimality condition for each P equation against M according to the following relation: Condition for Optimality:         ∇ M = λ ∇ P      with respect to C and T.