Illustration of modifying elements, MATLAB Programming

Illustration of Modifying Elements:

Illustration, the fifth element in the vector newvec is 9

>> newvec(5)

ans =

9

The subset of a vector, that would be a vector itself, can also be achieved using the colon operator. For illustration, the following statement would get the fourth through sixth elements of the vector newvec, and store the result in the vector variable b:

>> b = newvec(4:6)

b =

7  9  3

Any vector can be used for the indices in the other vector, not merely one created using the colon operator. For illustration, the following would get the first, fifth, & tenth elements of the vector newvec:

>> newvec([1 5 10])

ans =

1  9  15

The vector [1 5 10] is termed as index vector; it indicates the indices in the original vector which are being referenced.

The value stored in a vector element can be changed by identifying the index or subscript. For illustration, to change the second element from the vector b to now store the value 11 rather than of 9:

>> b(2) = 11

b =

7  11  3

Posted Date: 10/18/2012 4:17:00 AM | Location : United States







Related Discussions:- Illustration of modifying elements, Assignment Help, Ask Question on Illustration of modifying elements, Get Answer, Expert's Help, Illustration of modifying elements Discussions

Write discussion on Illustration of modifying elements
Your posts are moderated
Related Questions
Generate a script: To generate a script, click File, then New, and then M-file. The new window will appear known as the Editor. To generate a new script, simply type the serie

It is desired to determine the DFT of the analogue signal x (t) = 25 cos(10 Πt)cos(400Πt). (a) Find the Nyquist rate of the signal.   (b) What is the record (signal) length i

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.

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

I need this task to be done with discription of matlab coding.

how to make a histogram of data, example x=[5 6 3 2 5] and then find the distribution

Two cars started to move from zero position with (φ = 35) as shown. For the next four minutes, do the following: 1. Calculate each car's distance from the zero position (Distanc

Design a controller which regulates flow and compensate pressure to my desire value in simscape.

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

#defining matrix using only special commands