<< Chapter < Page Chapter >> Page >
This module is part of the collection, A First Course in Electrical and Computer Engineering . The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.

You can use the colon several ways in MATLAB (see help :). Its basic meaning is a vector of sequential values. For example, type

to get

For increments other than 1, use statements like

Most MATLAB functions will accept vector inputs and produce vector out- puts. The statement

builds a vector of integers from 1 to 10 and takes the square root of each of those numbers. Try it.

Now for another subtlety–what is the effect of each of the following statements and why?

Appending to a Matrix or Vector. A matrix or vector can be enlarged in size by appending new values to the old values. Let: x=[1 3 5]

x = [ x 6810 ] x = [ 1356810 ] y = [ x ; 1 : 6 ] y = 1 3 5 6 8 10 1 2 3 4 5 6 .

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, A first course in electrical and computer engineering. OpenStax CNX. Sep 14, 2009 Download for free at http://cnx.org/content/col10685/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A first course in electrical and computer engineering' conversation and receive update notifications?

Ask