MAT343_LAB01 - MATLAB sessions Laboratory 1 1 MAT 343 Laboratory 1 Matrix and Vector Computations in MATLAB In this laboratory session we will learn how

MAT343_LAB01 - MATLAB sessions Laboratory 1 1 MAT 343...

This preview shows page 1 - 3 out of 8 pages.

MATLAB sessions: Laboratory 1 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. helpbrowser: if you type helpbrowser in the command window the MATLAB’s help browser will open (alternatively you can click on the help button in the toolbar (this is the button with ? Symbol) 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 .
Image of page 1

Subscribe to view the full document.

2 MATLAB sessions: Laboratory 1 Matrices in MATLAB Entering matrices in MATLAB is easy. For example, to enter the matrix A = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 type A=[1, 2, 3, 4; 5, 6, 7, 8; 9, 10, 11, 12; 13, 14, 15, 16] or the matrix could be entered one row at a time: A=[ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] Once a matrix has been entered, you can edit it. Here are some examples: Input Output A(1,3) = 5 A = 1 2 5 4 5 6 7 8 9 10 11 12 13 14 15 16 Changes the third entry in the first row of A to 5 C = A(2:3,2:4) C = 6 7 8 10 11 12 Submatrix consisting of the en- tries in
Image of page 2
Image of page 3

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes