Class Notes (903,900)
US (349,943)
PSU (4,925)
CMPSC (10)
CMPSC 200 (4)
Lecture 3

CMPSC 200 Lecture 3: CMPSC 200 Lecture 03 Outline

3 Pages
27 Views

Department
Computer Science
Course Code
CMPSC 200
Professor
Bradley Sottile

This preview shows page 1. Sign up to view the full 3 pages of the document.
Page: of

Loved by over 2.2 million students

Over 90% improved by at least one letter grade.

Leah — University of Toronto

OneClass has been such a huge help in my studies at UofT especially since I am a transfer student. OneClass is the study buddy I never had before and definitely gives me the extra push to get from a B to an A!

Leah — University of Toronto
Saarim — University of Michigan

Balancing social life With academics can be difficult, that is why I'm so glad that OneClass is out there where I can find the top notes for all of my classes. Now I can be the all-star student I want to be.

Saarim — University of Michigan
Jenna — University of Wisconsin

As a college student living on a college budget, I love how easy it is to earn gift cards just by submitting my notes.

Jenna — University of Wisconsin
Anne — University of California

OneClass has allowed me to catch up with my most difficult course! #lifesaver

Anne — University of California
Description
Sottile CMPSC 200 Programming for Engineers with MATLAB Lecture 03 Outline Related Reading: Chapter 2, 2.3.2; Chapter 3, 3.1 through 3.4 Array Operations 1) MATLAB stores arrays of data as matrices 1 2 2) A few equivalent statements to write =3 4 a. A = [1 2; 3 4] b. A = [1,2; 3,4] c. A = [1 2; 3 4] d. A = [1,2; 3,4] 3) The th row and th column of a matrix can be found as A(i,j). 4) Shortcut for creating a row of regularly spaced sets of numbers a. Start at a, increment in steps of b until you get to c b. a:b:c or [a:b:c](MATLAB accepts both notations; the first is preferred) c. If no b is indicated, default is a:1:b Built-in MATLAB Functions Part I 1) Common Math Operations a. Absolute value: abs(x) b. Square root: sqrt(x) (compare it against x^0.5) c. th root: nthroot(x,n) d. Sign or Signum Function : sign(x), which returns: i. 1 if the corresponding element of x is greater than zero ii. 0 if the corresponding element of x equals zero iii. -1 if the corresponding element of x is less than zero e. Remainder: rem(x,y) (remainder of divided by ) f. Powers i. Exponents: 5 10 calculated as 5*10^10, 5*(10^10) or as 5E10 ii. Exponential: exp(x) calculates g. Logarithms i. ln (): log(x) (tricky to remember many languages do this, though) ii. log (): log10(x) iii. Change of base formula to get others: og () = 2) Rounding functions a. Rounding: round(x) (default, to integers; see help documentation for options) b. Truncation: fix(x) c. Floor (rounds to nearest integer towards ): floor(x) d. Ceiling (rounds to nearest integer towards ): ceil(x)
More Less
Unlock Document


Only page 1 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


OR

Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit