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
The Efficient Method: Though, in MATLAB, there is another built-in function which specifically produces random integers, i.e. randint. Calling the function with randint (1,1,n

Job: Add sinusoid with frequency 1000 Hz and amplitude 100 to the one generated in Job 1 (: Create a function using mat lab to generate a sinusoidal signal. The parameters of the s

function y=tps(r) % This is the thin-plate spline if r  y=0; else  y=r^2*log(r); end function y=fun(point) % my target function x=point(1); z=point(2); y=7-4*x^2+z^3;


Use Matlab to solve the following set of linear equations by Gaussian Elimination. Write a for loop to perform elementary row operations on the augmented matrix to produce

how to implement 3 out of 4 visual cryptography in MATLAB?

Reading from a File: A file has been once created; it can be read into a matrix variable. When the file is a data file, the load function will read from the file filename.ext

a) Develop and submit a power-based MC "SNR" simulator (derived from the voltage-based SNR program provided in MS Powerpoint file) that: i) Uses the following Input: Time period

Show (turn in) similar output images as in part 2 for each of your new images (there is only 1 connected component in this case). Write three functions which compute the moments, c

First order differential equations: Euler's method Finally, we consider ?nding the numerical solution for a ?rst order differential equation given an initial value. We consider