chapter 8 Flashcards
(21 cards)
branching
executes list of statements based on logical expression
binary operators
use parentheses to make order of operations more explicit
any(x)
true if x is not zero
isnan(x)
true if x is NaN
isfinite(x)
true if x is finite
isinf(x)
true if x is inf or -inf
logical operators with arrays
element wise, returns array of 0s and 1d based on if it meets argument
logical indexing
extract elements from array with logical array
logical array
array of 1s and 0s based on if elements are T or F
loops
execute statements between keywords repeatedly based on given conditions
tic
starts internal timer
toc
returns time in seconds since ic
ones(n,m)
created array of specific size filled with ones
zeros(n,m)
creates array of specific size filled with zeros
local functions
functions only accessible in current script/workspace, defined after main function
function handles
specific class of variable that is pointer to other functions @
pointer
variable that points to location in memory
function handle structure
funHandle = @functionName
you assign the function with a new name that can be referred to later in the code with the feval function.
feval example
[y2, y1] = feval(funHandle, x1, x2)
evaluates functions using x1 and x2 as inputs to funHandle
scope
parts of program that access variables value
nested function
function within another function, shares space with the parent function