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
can we use regression in bioinformatics toolbox?

Illustrations of if statement: illustrations of running this script: >> sqrtifexamp Please enter a number: -4.2 The sqrt of 4.2 is 2.0 >> sqrtifexamp Please ent

my project is on load frequency control using FPID tuned using GA and PSO algorithm.the system is a two area system.

The cost of sending a package by an express delivery service is $15 for the first two pounds, and $4.25 for each pound over two pounds. Write a program that computes the cost of

Minimum Cost Pizza Problem. Using only the items given in the tables below, create a minimum cost pizza which satis?es both the nutritional requirements of Table 1 and bounds on it


The mass of the spring-mass-damper system shown below was initially displaced by 1 meter to the right and then released. The subsequent acceleration of the mass was measured using

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

Show the output - algorithms: Where does the output go? The two possibilities are (i) to an external file, or (ii) to a window on the screen. Based on system, one of these wil

The circuit diagram of an active filter is shown below. (a) Determine an expression for the transfer function of the filter. (b) Hence find an expression for the frequency res