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
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

Write a MATLAB program to find the undamped natural frequencies and modes of an electric car treating it as a four degree of freedom system. Determine the undamped natural frequenc

A 300 km, 3-phase, 50Hz transmission line has spacing as shown in Figure 2. Each phase of the line consists of a bundle of three conductors.  (a) Find the total per-phase induct

Create a text file with simulated data. Calculate an experimental y using the first function and some reasonable values for the parameters Add noise Save the x values and ca

Example of variable names: If nothing appears when, who or whose is entered, which means there aren't any variables! For illustration, in the starting of a MATLAB session, the


1;write a matlab of geuss elimination with scaling and pivoting under consideration?

Run the MATLAB script sum = single(0); term = single(1); n=1; while sum + term > sum sum = sum+term; n=n+1; term = 1/n; end n Explain what you think it is trying to do. What wou

This can be done from the command line or from a makefile. You require a script (filename.m). Just type at the command line, or contain in the makefile: matlab

Write a function that solves a system of linear equations or calculates the inverse of a matrix by Gauss-Jordan elimination. Your function should accept a matrix as an argument and