ENGR 101 Study Guide - Fall 2018, Comprehensive Midterm Notes - Amplitude Modulation, Positive-Definite Matrix, Array Data Structure
ENGR 101
MIDTERM EXAM
STUDY GUIDE
Fall 2018
'whos'&lists%in%alphabetical%order%the%names,%sizes,%and%types%of%all%the%variables%
in%the%workspace.%
•
'char'&(character)&refers%to%the%letters,%single%quotes%('')%
•
Strings refer%to%words%("")%
•
ones(m,n)%creates%a%m%*%n%matrix%of%zeroes%
•
ones(m)%same,%but%uses%m%for%both%rows%and%columns%
•
Each%column%sum%=%each%row%sum%=%each%diagonal%sum%
o
magic(s)%creates%an%s%x%s%"magic"%matrix
•
Creates%a%new%matrix%based%on%repeating%matrix%A%a%certain%number%of%times%in%
the%x%and%y%direction
o
repmat(A,%xTimes,%yTimes)%
•
Creates%a%new%matrix%with%the%same%elements%as%A,%but%the%requested%number%
of%rows%and%columns.%The%dimension%must%match%with%the%original%number%of%
o
reshape(A,%numRows,%numCols)%
•
Functions
Wednesday,% September% 27,%2017
9:48%AM
find more resources at oneclass.com
find more resources at oneclass.com
of%rows%and%columns.%The%dimension%must%match%with%the%original%number%of%
elements%in%A.%
Numel(x)%yields%the%#%of%elements%in%x%
•
Length(x)%yields%the%number%of%elements%along%the%longest%dimension%of%x%
•
Size(x)%yields%a%vector%with%the%#%of%elements%along%each%dimension%of%x%
•
"Array%operations"%work%with%array%element-by-element
•
•
Vector%indexing
•
Bad%idea
o
Code%duplication%occurs%when%you%have%more%than%one%of%code%that%does%the%same%
thing
•
It's%an%algorithm%because%we%can%use%it%without%having%to%worry%about%
what's%inside.%
○
Is%an%algorithm%that%returns%data%to%the%caller,%and%operates%independently%of%
the%caller.%
o
Ex.%sqrt%function.%
o
The%interface%of%a%functions%describes%how%we%use%it
o
Functions&
•
Ex.%sum%function%
o
Many%work%column%by%column:%
o
Functions%with%matrices:
•
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
"whos" lists in alphabetical order the names, sizes, and types of all the variables in the workspace. "char" (character) refers to the letters, single quotes ("") Strings refer to words () ones(m,n) creates a m * n matrix of zeroes ones(m) same, but uses m for both rows and columns magic(s) creates an s x s magic matrix o. Each column sum = each row sum = each diagonal sum repmat(a, xtimes, ytimes) o. Creates a new matrix based on repeating matrix a a certain number of times in the x and y direction reshape(a, numrows, numcols) o. Creates a new matrix with the same elements as a, but the requested number of rows and columns. The dimension must match with the original number of of rows and columns. The dimension must match with the original number of elements in a. Numel(x) yields the # of elements in x.