### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# NUMERICAL LINEAR ALGEBRA MATH 526

GPA 3.51

### View Full Document

## 32

## 0

## Popular in Course

## Popular in Mathematics (M)

This 4 page Class Notes was uploaded by Cassidy Grimes on Monday October 26, 2015. The Class Notes belongs to MATH 526 at University of South Carolina - Columbia taught by Staff in Fall. Since its upload, it has received 32 views. For similar materials see /class/229542/math-526-university-of-south-carolina-columbia in Mathematics (M) at University of South Carolina - Columbia.

## Reviews for NUMERICAL LINEAR ALGEBRA

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/26/15

Basics of Matlab Matlab is short for Matrix laboratory and that describes it pretty well I Entering Matrices and Accessing Their Elements There are several ways to enter a matrix in Matlab gtgt A l 2 3 4 5 6 7 8 W will make the matrix A 2 3 4 5 6 8 9 You could make the same matrix by rst making the row vector rowl l 2 3 and a similar row2 and row3 and then typing gtgt A rowl row2 row3 Or you could set columnl 1 4 7 with matching column2 and columnB and then gtgt A columnl column2 columnB Note Entries in a row are separated by spaces or commas and the rows are separated by semicolons B rowl row2 row3 would create B l 2 3 4 5 6 7 8 9 A few special matrixmaking commands eye n creates the n x n identity matrix zeros n m creates the n x m zero matrix rand n m creates an n x m matrix with uniformly distributed random elements between 0 and 1 You can access individual elements in a matrix by using the subscript notation A i j A l 2 13 will set the rst row second column to be 13 Also you can extract a smaller matrix from a larger one If H is a 10 x 10 matrix then gtgt K Hl56lO will pull out the block from rows 1 through 5 and columns 6 through 10 inclusive making K a 5 x 5 matrix It works the other way around too If K has already been de ned to be 5 x 5 then gtgtHl56lO K will reset the upper righthand block of H to be all of K The notation A 2 is a vector of the elements in the second row of every column of A ie the second row of A The colon can also be used to make vectors that increase at regular intervals gtgtX 10 1O12 1 results in 1 12 13 14 15 16 17 18 19 20 II Matrix Operations and Functions Transpose and Multiplication Determinant Inverse Division The apostrophe transposes a matrix gtgt B A makes a matrix called B that is equal to A transpose The semicolon at end of a statement tells the computer not to output the answer to the screen Also gtgt A creates a matrix called ans and sets it equal to A transpose You can then set B ans ifyou need to use A transpose often gtgt D A B 7 C is selfexplanatoryjust be sure to remember that A B and C must all have the same dimensions However matrix scalar is also de ned with gtgt D A 3 being used to add three to every element in A Also you can overwrite A with the new A like gtgt A A 3 You can multiply two matrices provided their dimensions allow it with gtgt C A B Multiplication by a scalar is also de ned gtgt C piA det A returns the determinant of the matrix inv A returns the inverse of the matrix provided that it actually has one There are two division operations and To solve the matrix equation AX B use gtgt X AB In this case X is equal to inv A B however Matlab does not actually compute the inverse but uses a faster algorithm To solve the equal XA B use gtgt X BA Powers Eigenvalues This corresponds to X B inv A You can also use for matrixscalar division gtgt A A 4 divides each element of A by 4 If A is square and p is an integer greater that one you can raise A to the pth power with the A like this gtgt B AAp eig A returns a vector containing the eigenvalues of A which may be complexvalued Elementbyelement functions Several library functions operate on an elementbyelement basis For example B sin A returns a matrix the same size as A with B i j sin A i j Other functions like this include cos cosine tan tangent asin 7 arcsine acos 7 arccosine a t a n 7 arctangent s i nh 7 hyperbolic sine t anh 7 hyperbolic tangent a co 5 h 7 hyperbolic arccosine sqrt 7 square root exp 7 exponential base 6 l o g 7 natural logarithm logl 0 7 log base 10 co 5 h 7 hyperbolic cosine a s i nh 7 hyperbolic arcsine a t a nh 7 hyperbolic arctangent abs 7 absolute value Putting a period before A makes these operator act elementby element Witness iful 2 3 and v4 5 6 then uv 4 10 18 LLAV l 32 729 III2 D Graphics Use the plot function to create a 2D plot of a set of data If y is a vector then plot y will plot each element of y against its index on the xaxis If x and y are vectors of the same length then plot x y will create a plot x versus y These labeling functions may be helpful title your title adds atitle abovethe plot xlabel your label labels the xaxis ylabel your label labels the yaxis By default plot x y will connect the points with straight blue lines A third argument a character string enclosed in single quotes may be added to format the plot Use this table to make your preferred string by combining one color symbol with one line style symbol For example plot x y r will put red pluses at each point ofthe data and plot x y g will connect the points with a green dashdotdashdot line You can plot more that one set of data on the same coordinate axes If 2 is another vector of the same length as x and y plot x y x z will create aplot with a dotted line of x versus y and a dashed line of x versus 2 You can add an additional plot to an existing one by using the hold command The last plot can also be made with these commands gtgt plotxy gtgt hold on gtgt plotltzy39e gt gtgt hold off The commands l ogl og s emi l ogx and s emi l ogy workjust like pl ot For example 5 emi logy x y makes a plot ofx versus y using the logarithmic scale for the yaxis and the linear scale for the xaxis

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "I made $350 in just two days after posting my first study guide."

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.