PDF Archive

Easily share your PDF documents with your contacts, on the Web and Social Networks.

Share a file Manage my documents Convert Recover PDF Search Help Contact



Lab1(1) .pdf



Original filename: Lab1(1).pdf
Author: Bruno D. Welfert

This PDF 1.4 document has been generated by LaTeX with Beamer class version 3.24 / dvips + GPL Ghostscript 9.10, and has been sent on pdf-archive.com on 08/04/2016 at 21:20, from IP address 75.167.x.x. The current document download page has been viewed 807 times.
File size: 114 KB (20 pages).
Privacy: public file




Download original PDF file









Document preview


MAT 343 Laboratory 1
Matrix Computations in M ATLAB
Bruno D. Welfert

School of Mathematical & Statistical Sciences

Goals

In this laboratory session you learn how to

Create matrices and vectors

Manipulate matrices and create matrices of special types

Perform arithmetic and algebraic operations on matrices

Solve linear systems

©2015 B. Welfert

MAT 343 Laboratory 1

2/20

The M ATLAB Desktop Display
The MATLAB default desktop consists of four windows:
The Command Window

where M ATLAB commands are entered and executed

The Current Directory Browser
to view M ATLAB and other files and perform file operations (opening, editing, search)

The Workspace Browser
to view and make changes to the contents of the workspace

The Command History
to view a log of past commands used in the command window.
To repeat a past command, double-click on the command to execute it
To recall/edit a past command directly from the command window use the arrow keys
Press the Enter key to execute an edited command

To close a M ATLAB window click on × in the upper right corner of the window.
To detach a window from the M ATLAB desktop, click on the arrow next to ×
©2015 B. Welfert

MAT 343 Laboratory 1

3/20

Help Facility
M ATLAB includes a HELP facility.
helpbrowser
if you type helpbrowser in the command window the M ATLAB’s help browser will open
(alternatively you can click on the help menu

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 whose
name or description contains keyword. For example, typing lookfor identity lists 2
functions that create identity matrices

If you have never used M ATLAB before:
Type demo at the M ATLAB prompt >>
Click on Getting Started with M ATLAB video
Move on to Working in the Development Environment and Working with
Arrays
©2015 B. Welfert

MAT 343 Laboratory 1

4/20

Recording the M ATLAB session

Create a directory (folder) on your computer to save your M ATLAB work
Use the Current Directory field in the desktop toolbar to change the
directory to the folder
Record your session
>>
>>
>>
>>
>>
>>
>>
>>

©2015 B. Welfert

d i a r y lab1 . t x t % r e c o r d s commands / o u t p u t
f o r m a t compact % removes blank l i n e s i n o u t p u t
% MAT 343 Lab 1
% Question 1
. . . % Enter commands
% Question 2 ( a )
. . . % Enter commands
diary o f f % turns o f f recording

MAT 343 Laboratory 1

5/20

Matrices in M ATLAB

To input



1 2 3
A = 4 5 6
7 8 9
type
>> A = [ 1 , 2 , 3 ; 4 , 5 , 6 ; 7 , 8 , 9 ]
or, one row at a time (press Enter at the end of each row),
>> A = [ 1 2 3
4 5 6
7 8 9]

©2015 B. Welfert

MAT 343 Laboratory 1

6/20

>> A = [ 2 , 1 ; − 1 , 1 ] , B = [ 1 , 0 ; 2 , 1 ]
A =
2 1
−1 1
B =
1 0
2 1
>> A+B % m a t r i x sum
ans =
3 1
1 2
>> A * B % m a t r i x p r o d u c t
ans =
4 1
1 1
>> A . * B % c o e f f i c i e n t w i s e p r o d u c t
ans =
2 0
−2 1

©2015 B. Welfert

MAT 343 Laboratory 1

7/20

>> A = [ 2 , 1 ; − 1 , 1 ]
A =
2 1
−1 1
>> 4 * A % s c a l a r m u l t i p l i c a t i o n
ans =
8 1
−4 4
>> A ’ % tr ans pos e
ans =
2 −1
1 1
>> Aˆ 2 % A * A
ans =
3 3
−3 0
>> A . ˆ 2 % c o e f f i c i e n t w i s e s q u a r i n g
ans =
4 1
1 1
©2015 B. Welfert

MAT 343 Laboratory 1

8/20

>> A = [ 2 , 1 ; − 1 , 1 ] , B = [ 1 , 0 ; 2 , 1 ]
A =
2 1
−1 1
B =
1 0
2 1
>> [ A , B ]
ans =
2 1 1 0
−1 1 2 1
>> [ A ; B ]
ans =
2 1
−1 1
1 0
2 1

©2015 B. Welfert

MAT 343 Laboratory 1

9/20


Related documents


lab1 1
wifi not available or broken after windows 10 update
windows 10 wi fi not working find the fixes here
get rid of error 80240020 while upgrading to windows 10
fix wi fi connection issue on windows 10 update
how to run 16 bit applications on windows 10 witho


Related keywords