×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

## ENGR 121, Lab notes, Week 1

by: spencer.kociba

42

0

3

# ENGR 121, Lab notes, Week 1 ENGR 121-B

Marketplace > Drexel University > Engineering and Tech > ENGR 121-B > ENGR 121 Lab notes Week 1
spencer.kociba
Drexel

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

Summary of lab: MATLAB Tutorial, basic vocabulary and hands on work with the program *This set of notes is very much like a beginner's glossary or can be used as a reference to basic commands in M...
COURSE
Computation Lab I
PROF.
TYPE
Class Notes
PAGES
3
WORDS
CONCEPTS
Engineering, Matlab, programming, Tutorial, Vocabulary, reference
KARMA
25 ?

## Popular in Engineering and Tech

This 3 page Class Notes was uploaded by spencer.kociba on Wednesday September 21, 2016. The Class Notes belongs to ENGR 121-B at Drexel University taught by in Fall 2016. Since its upload, it has received 42 views. For similar materials see Computation Lab I in Engineering and Tech at Drexel University.

×

## Reviews for ENGR 121, Lab notes, Week 1

×

×

### What is Karma?

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

Date Created: 09/21/16
ENGR 121 B  Lab Notes for 9/21/2016 Spencer Kociba Summary of lab: MATLAB Tutorial, basic vocabulary and hands on work with the program *This set of notes is very much like a beginner's glossary or can be used as a reference to  basic commands in MATLAB ***Note: Important phrases, commands and concepts are in bold ● Uppercase vs lowercase matters ● Default variable is “ans” and will change if you do not assign a fixed variable  to your outcome ● multiplication= * ● division= / ● Variable = assignment   <<this is the format for assigning variables ● Clear (variable name) = remove variable from workspace ● MATRICES ○ >>C=[1,2,3,4,5]  <<commas can also be spaces  ○ >>size(C) ○ ans= 1     5 ○ Size = shows row by columns size of the matrix named ● Use a semicolon to suppress output in the command window (keeps space  uncluttered) ○ Ex. >>mynum=6; ○ >>mynum+34; ○ >>y=mynum/2 ○ >> ans = ○ >> y=20 ● who= shows all names of all variables in your workspace ● clc= clear all of command window (variables remain in workspace) ● Clear all  = deletes all variable assignments ● New Script Button: pulls up editor that you can edit, delete, run and save  written codes/programs (great for testing programs to get a certain answer aka the  quizzes coming up in later weeks) ○ Ex. 1­ x=10; ○ 2­ y=5; ○ 3­ z=x+y ○ “RUN” ○ ans=  ○ z=15 ● % in front of a command (in editor)= suspends actions in the program (if  running multiple times ○ Ex. 1­ %clear all ○ 2­ clc ○ 3­ x= x+4; ○ 4­ y=5; ○ 5­ z=x+y ■ z= (this value would increase every time you run the program) ■ If you remove the % in front and the (x+4) the  program will run as normal ● ( *number) ^ (power) *? ○ Is:  (value) (number)❑ ∗(value∗π) ○ Is NOT:  (number)❑ ● theta=_______ : assigned angle ○ Default is radians ● (trig func)d (____) = trig func results in degrees ● help(command name): detailed explanation of how the command works,  different uses for command, and differrent notations of the command in MATLAB ● exp(value):  e❑ (value) ○ ­5^2 = ­25 ○ (­5)^2= 25 ● fix()= rounds towards zero of nearest  ○ Negatives #s round up  ○ Positives #s round down ● round(X,N) = round to the Nth digit to the right of the decimal ● ceil(X) = round to the nearest integer towards infinity ● floor(X) = round to nearest integer towards negative infinity ● std= standard deviation (usually combined with randn(__)) ● = is used as the assignment operator ● == is used in a logical operation like “is the left equal to the right side in this  equation (will result in logical output of 0 or 1) ● PLOTTING ○ Creating plots/graphs in MATLAB requires a few steps ■ >>x= (number you want the x axis to start on): (increment):(number to end with); ■ >>Figure; ■ >>plot(variable or expression/equation); ■ >>y=(number you want at the top of the figure): (increment):(number you want at the bottom of the figure) ○ A graph will appear on your screen, with the x and y axis  labeled by the increments and in the range that you indicated  ● RANDOM NUMBERS ○ rand(a)= a x a matrix of random numbers in the range (0,1) ■ (all possible numbers between but not including  0 and 1) ■ ○ rand(a,b)= a x b matrix of random numbers in the range (0,1) ■ Addition or subtraction operations will change  the starting number of the range ● Ex. 5 + rand(a) has a range of  (5,6) ■ Multiplication or division will change the width of the range ● Ex. 5*rand(a) has a range of  (0,5) ○ randi(a,b)= b x b matrix of integers in the range (0, a) ■ (all possible integers between AND including 0  and a) ■ ○ randi([a,b],c,d)= range of (a,b) and matrix of c x d ○ randn() =bell curve of random deviations ■ Ex. 1+ 2*randn(100,1) ■ Mean= 1, StD= 2, Data generated in a 100 x 1  matrix ● LOGICAL TESTING ○ Outputs ■ 1=true ■ 0=false ○ > = is ≥ ○ < = is ≤ ○ ~ = is ≠ ○ && is “u and v” ○ || is “u or v” ■ Need to use && or || when doing several  inequalities in a row like or MATLAB will use order of operations ● Ex. >> 10>5>2 ● >>(logical:1)>2 ● >>logical: 0 ● Instead input: >> 10>5&&5>2

×

×

### BOOM! Enjoy Your Free Notes!

×

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

Jim McGreen Ohio University

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

Allison Fischer University of Alabama

#### "I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over \$600 per month. I LOVE StudySoup!"

Bentley McCaw University of Florida

Forbes

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

Become an Elite Notetaker and start selling your notes online!
×

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