MATLAB sessions: Laboratory 1 MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB In this laboratory session we will learn how to 1. Create matrices and vectors. 2. Manipulate matrices and create matrices of special types 3. Add and multiply matrices Preliminaries The MATLAB Desktop Display The MATLAB default desktop consists of four windows: the command window, the Current Directory Browser, the Workspace Browser, and the Command History. • The command window is where MATLAB commands are entered and executed. • The Current Directory Browser allows you to view MATLAB and other files and to perform file operations such as opening and editing or searching for files. • The Workspace Browser allows you to view and make changes to the contents of the workspace. • The Command History allows you to view a log of all the commands that have been entered in the command window. To repeat a previous command, just click on the command to highlight it and then double-click to execute it. You can also recall an edit command directly from the command window by using the arrow keys. From the command window, you can use the up arrow to recall previous commands. The commands can then be edited using the left and right arrow keys. Press the Enter key of your computer to execute the edited command. Any of the MATLAB windows can be closed by clicking on the × in the upper right corner of the window. To detach a window from the MATLAB desktop, click on the arrow that is next to the x in the upper right corner of the window. Help Facility MATLAB includes a HELP facility that provides help on all MATLAB features. • doc: if you type doc in the command window the MATLAB’s help browser will open (alternatively you can click on the Help button in the Home toolbar .) • help : if you know the exact name of a function, you can get help on it by typing help functioname. For example, typing help help provides help on the function help itself. • lookfor: If you are looking for a function, use lookfor keyword to get a list of functions with the string keyword in them. For example, typing lookfor ’identity matrix’ lists functions (there are two of them) that create identity matrices. If you have never used MATLAB before, we suggest you type demo at the MATLAB prompt. Click on Getting Started with MATLAB and run the file. Then move on to the demo on Working in the Development Environment and the demo on Working with Arrays. c 2011 Stefania Tracogna, SoMSS, ASU 1 MATLAB sessions: Laboratory 1 Matrices in MATLAB Entering matrices in MATLAB is easy. For example, to enter the