### Create a StudySoup account

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

Already have a StudySoup account? Login here

# Computing for Engineers CS 1371

GPA 3.81

### View Full Document

## 8

## 0

## Popular in Course

## Popular in ComputerScienence

This 0 page Class Notes was uploaded by Alayna Veum on Monday November 2, 2015. The Class Notes belongs to CS 1371 at Georgia Institute of Technology - Main Campus taught by David Smith in Fall. Since its upload, it has received 8 views. For similar materials see /class/234168/cs-1371-georgia-institute-of-technology-main-campus in ComputerScienence at Georgia Institute of Technology - Main Campus.

## Reviews for Computing for Engineers

### 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: 11/02/15

Arrays Arrays vs Vectors All vectors are just 1 row arrays Arrays also homogenous collections gt Every value must be the same Arrays must always be rectangular gt You can never have a jagged array gt If you try to make one matlab will usually error or fill in zeros Creating Arrays Direct Access gt Use semi colons to separate rows Each row must be the same length Functions gt Linspace and colon can39t make arrays gt ones zeros rand can AccessingIndexing Emphasize index row then column Show indexing still done in parentheses but we separate each dimension by a comma gt arrr c v Single indexing gt Same rules apply must be positive integers in the range I arr2 7 I arr4 8 I row then column shorthand operators End I end is in relation to the position I arrend l end Wil be the value of the last row I arrl end end will be the value of the last column I arrend end is fine each end will just be the value for that dimensin I end makes no context outside of indexing If you want dimensions use size Colon z gt colon means all of that dimension I arrl first row all columns I arr l all rows first column I arr all rows all columns equivalent to just doing arr J Multiple ndices IMPORTANTIII gt Matlab returns the intersection of the rows you want and the columns you want I arrrows7want colsgwant I rowsiwant a vector of row indices I colsgwant a vector of col indices I The output array will be dimensions lengthrows7wantlengthcols7want I Example o arrl 3 5 2 4 9 Output is a 3x2 Q Will have the l 3 5 rows but only with the values at the columns 2 Setting positions gt Same as vectors except now specify rows and columns gt specify the spots you want to set on the left hand side want in those spots on the right hand side I IMPORTANT Spots you specify and the values you put in those spots must be same dimension or the value must be scalar and what you Deleting elem en t5 gt Can only delete rows or columns else the array will become jagged I arrl gt deletes first row I arr 3 gt deletes 3rd column I arr24 j gt deletest rows 2 and 4 gt ERRORS 39 arr3 2 1 I arr3 lzend I Must use to delete Linearized Indexing giving one position is not an error gt arr7 is ok When doing linear indexing the indices are found by counting down the columns To linearize an array to a column vector just do gt arr If you want that to be a row vector just transpose or gt arrlend When array is linearized it just goes down the columns Indexing with one specification always leads to a vector gt vecl35 gt vector gt arrl35 gt vector Slicing topbottom halves gt arrlend2 z arrend2lend quarters odd rowscolumns even rowscolumns Reversing rowscolumns Logical Indexing arrays The masking principle You are basically overlaying another arrayvector of trues and false and the only spotsthat come out is where there were trues To find the elements greater than 4 gt arrarr gt 4 gt No need to specify rows and columns with logicals gt arr gt 4 gives you a logical ARRAY that overlays on top of the original If you do b arrarr gt 4 output always a vector gt Since you are indexing with only one input it is like linear indexing If setting using logicals arrarr7condl arrarr7cond2 gt arrgcondl and arricond2 must have the same number of trues v Since linear indexing only important that the number of indices specified on each side is the same or gt arrarr4condl 5 gt Setting with scalar value on right the right is scalar v IMPORTANT Even though indexing with linear inputs the array on the left hand side maintains its dimensions gt It only linearizes it if it was on the right hand side of an equal sign Array Operators when to use vs gtn trix multiplication versus scalar multiplication gtthe same idea is true and A gt14ention the cases where it is ok to use either aka when one of the values is scalar v Transposing an array 39 gtan MxN array becomes an NxM gtShow how to transpose an array each row becomes a column in the new array Array Functions functions like sum mean go down the columns gtlf you want to go across rows you can either I sumA39 aka make the rows columns or I sumA v To get the overall of an array use the fact that the sum of the sum along the columns is just the overall sum sumsumarr gtn anmeanarr gt1ninminarr

### 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 used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

#### "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."

#### "Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

### 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.