Basic Data Elements

The basic elements that MATLAB uses are matrices. Once the matrices have been entered or generated, the user can quickly perform sophisticated computations with a minimal amount of programming.

Entering matrices in MATLAB is easy. To enter the matrix

[12345678910111213141516]

type

A=[1234;5678;9101112;13141516]

or the matrix could be entered one row at a time:

A=[12345678910111213141516]

Once a matrix has been entered, you can edit it in two ways. From the command window, you can redefine any entry with a MATLAB command. For example, the command A(1,3)=5 will change the third entry in the first row of A to 5. You can also edit the entries of a matrix from the Workspace Browser. To change the (1,3) entry of A with the Workspace Browser, we first locate A in the Name column of the browser and then click on the array icon to the left of A to open an array display of the matrix. To change the (1,3) entry to a 5, click on the corresponding cell of the array and enter 5.

Row vectors of equally spaced points can be generated using MATLAB’s: operation. The command x=2:6 generates a row vector with integer entries going from 2 to 6.

x=23456

It is not necessary to use integers or to have a step size of 1. For example, the command x=1.2:0.2:2 will produce

x=1.20001.40001.60001.80002.0000
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.16.254