click below
click below
Normal Size Small Size show me how
Stack #4646915
| Question | Answer |
|---|---|
| format long | shows 15 decimal places of answer |
| sqrt() | square root |
| i, j | imaginary component of numbers |
| exp() | e^() |
| log() | ln() |
| log10() | log() |
| abs() | absolute value/complex magnitude |
| sin() vs sind() | radians vs degrees |
| asin() vs asind() | inverse sine in radians vs degrees |
| atan2() | four-quadrant inverse tangent |
| log1p() | log(1+x) |
| angle() | phase angle (polar angle) |
| complex() | construct complex data from real & imaginary parts |
| conj() | complex conjugate |
| imag() | complex imaginary part |
| real() | complex real part |
| fix() | round towards zero |
| floor() | round towards negative infinity |
| ceil() | round towards positive infinity |
| round() | round towards nearest integer |
| who | define all variables in workspace |
| min() | minimum value in an array |
| max() | maximum value in an array |
| mean() | average of an array |
| std() | standard deviation of an array |
| sum() | sums up an array |
| prod() | multiplies every value in an array |
| length() | determines the length of an array |
| .* | multiplies two matrices: # of columns of first matrix must match # of rows of second matrix |
| ./ | divides two matrices: # of columns of first matrix must match # of rows of second matrix |
| .^ | raises every element in an array to a power |
| plot(x,y) | plots a function y at points x |
| grid, xlabel, ylabel, title | modifications to a plot |
| y(end) | gives the number stored in the last position of array y |
| [ymax, imax] = max(y) | returns both the max and the index at which the max occurs |
| y([a b c]) | returns the a b and cth elements of array y |
| polyval(x,p) | evaluates polynomial given by coefficients in array x at point p |
| roots(p) | gives the roots of a polynomial |
| polyfit(x,y,n) | finds the polynomial that best fits a set of data (x,y) in the order n |
| conv(p1,p2) | multiplies two (not more) polynomials together (size does not need to match) |
| poly(r) | takes the roots of a polynomial and returns the coefficients of the polynomial |
| deconv(p1,p2) | divides two polynomials |
| dot(x,y) | finds the dot product of two vectors |
| cross(x,y) | finds the cross product of two vectors (must be 3D vectors) |
| norm(x) | finds the length/magnitude of a vector |
| size() | gives the number of rows and columns in a matrix |
| * | for vector-matrix multiplication (length of vector must equal the number of columns of the matrix) |
| B*A/=A*B | matrix multiplication is not commutative |
| eye(n) | creates a square identity matrix of dimension n |
| inv(A) | inverts a square matrix A |
| det(A) | calculates the determinant of a matrix A |
| for k = a:b code end | basic for loop structure |
| function y = name(x) code r = final answer end | basic function structure |
| && | logical and |
| || | logical or |
| 1 and 0 | logical true and false |
| if (logical expression) code end | basic if structure |
| if (logical expression) code else if(logical expression) code else code end | basic if if else structure |