







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An extensive list of matlab functions and operators, including their definitions, examples, and usage. It covers various categories such as arithmetic, logical, matrix, string, and more. This resource is useful for students and professionals working with matlab for data analysis, programming, and mathematical computations.
Typology: Exams
1 / 13
This page cannot be seen from the preview
Don't miss anything!








[3,5;2,4;1,9] - ANSWhat is matrixC after executing the following statement? matrixA = [ 3, 1, 4; 2, 5, 9 ]; matrixC = reshape( matrixA, 3, 2 ) \ - ANSTwo backslash characters print one backslash character. Note that a single backslash character would instead indicate the start of a special character sequence like \n. \n - ANSprints a new line \t - ANSprints a tab & - ANSboolean & %-8.2f - ANSFixed-point occupying a minimum of 8 digits, left-aligned, with 2 digits to the right of the decimal point. %.4f - ANSFixed-point with 4 digits to the right of the decimal point. %% - ANSTwo percent characters print one percent character. Note that a single % character would instead indicate the start of a formatting operator like %f. %c - ANScharacter %d - ANSinteger %e - ANSscientific notation %E - ANSscientific notation %f - ANSfixed-point %G - ANSeither %f or %E whichever is shorter %g - ANSwither %f or %e whatever is shorter %i - ANSinteger %s - ANSstring | - ANSboolean or ~a or not(a) - ANSNot negates or complements the value of a, returning true if a is false, and vice versa. 0
assignment operator - ANSThe '=' is kn own as the ______. assignment statement - ANSsuch as age = 20; upon being executed, writes the current value of the item on the ='s right side into the variable on the ='s left side. atan2 - ANSfour quadrant inverse tangent boolean value - ANSlogical value aka ______ ______. char(numericArray) - ANSconverts the numeric array numericArray into a character vector charVec2 corresponding to the Unicode transformation format 16 (UTF-16) code. char(stringScalar) - ANSconverts the string scalar stringScalar into a character vector charVec1. clc - ANSClears the command window. Does not affect the workspace, meaning variables are unchanged clear - ANSclears all variables from the workspace, so all variable values are lost. close(n) - ANScloses figure number n comment - ANSThe interpreter ignores all text to the right of "%" on a line, so the programmer can write any text there. compose(formatSpec,arrayIn) - ANSformats the data in arrays arrayIn, using formatting operators specified by formatSpec and returns the resulting text in stringArrayOut. The compose function formats values from arrayIn in column order. contains(String1,TestPattern) - ANSperforms a case-sensitive logical comparison returning 1 (true) if scalar array string1 contains the specified testPattern, and returns 0 (false) otherwise. If testPattern is a string array containing multiple patterns, then contains returns 1 if string1 contains any element of testPattern. contains(string1, testPattern, 'IgnoreCase',true) ignores case when determining if string1 contains testPattern. cos - ANScosine cosd - ANScosine in argument of degrees cosh - ANShyperbolic cosine cot - ANScotangent
count(stringIn, patternSeek) - ANSreturns the number of occurrences of string scalar patternSeek in the string scalar stringIn. count(stringIn, patternSeek, 'IgnoreCase', true) ignores case when counting the number of occurrences of pattern. csc - ANScosecant ctrl-c - ANSWhile not a MATLAB command, this keystroke sequence interrupts an endless MATLAB calculation that a programmer may have entered accidentally. Afterwards, the programmer can enter a new command. diag([vector]) - ANSreturns a square array with the values in the 1D array argument vector on the diagonal and zeros elsewhere diary - ANSRecords into a file almost everything that appears in the command window. The file's name is chosen by programmer, such as "my session.txt". "diary off" ends the recording dis(distance); - ANSOutput the value of a variable named distance. double colon operator - ANSconstructs a numeric row array by specifying a starting value, an increment value, and a terminating value, with those values separated by colons. Ex: myArray = [5:1:9] yields array [5, 6, 7, 8, 9]. endsWith(String1,TestPattern) - ANSperforms case-sensitive logical comparison returning 1 (true) if scalar array string1 end with the specified testPattern, and returns 0 (false) otherwise. If testPattern is a string array containing multiple patterns, then endsWith returns 1 if string1 ends with any element of testPattern. endWith(string1, testPattern, 'IgnoreCase', true) ignores case when determining if string1 ends with testPattern. exit - ANSexits the MATLAB session exp - ANSexponential eye - ANSreturns an m by n array aEye with ones on the main diagonal and zeros elsewhere. figure(n) - ANSmakes figure number n the current figure find(inputAr) - ANS______ locates all nonzero elements of inputAr and returns the linear indices of these elements in outLin. If inputAr is a row array, then outLin is a row array; otherwise, outLin is a column array. If the values of the array elements are needed, the statement inputAr(outLin) is used.
isa(obj,ClassName) - ANSdetermines whether input obj is an object of specified class ClassName. ischar - ANSdetermines whether a variable is a string ischar(charVecIn) - ANSreturns a single logical true (1) value if the input charVecIn is a character array, returning logical false (0) otherwise. ischar(inArray) - ANStests for character vector. iscolumn(inArray) - ANStests for column 1D arrays. isempty(inArray) - ANStests whether inArray is empty. isequal(inArray1,inArray2,....,inArrayN) - ANStests whether input arrays inArray1, inArray2, through inArrayN have the same contents (i.e., whether each array element at each index is equal).All NaN (not a number) values are considered to be NOT equal to each other. isequaln(inArray1,inArray2,....,inArrayN) - ANStests whether input arrays inArray1, inArray2, through inArrayN have the same contents (i.e., whether each array element at each index is equal). All NaN (not a number) values are considered to be equal to each other. isfinite(inArray) - ANSreturns a logical array finiteArray, of the same size as inArray. The value at finiteArray(index) is true when inArray(index) is finite. Otherwise, the values are false. isfinite(x) - ANSReturns true if x is finite; otherwise, returns false. For example, isfinite(Inf) is false, and isfinite(10) is true. isfloat(inArray) - ANStests for floating-point array. isinf(inArray) - ANSreturns a logical array infiniteArray, of the same size as inArray. The value at infiniteArray(index) is true when inArray(index) is infinite. Otherwise, the values are false. isinf(x) - ANSReturns true if x is +Inf or -Inf; otherwise, returns false. isinteger(inArray) - ANStests for integer array. isletter - ANSReturns the indices of all the alphabetic characters in a string. isletter(charVecIn) - ANSfinds all alphabetic letters in the character vector charVecIn. Returns an array the same size as charArrayIn containing logical true (1) at indices
where the elements of charVecIn are letters of the alphabet and logical false (0) where they are not. islogical(inArray) - ANStests for logical array. ismatrix(inArray) - ANStests for 2D arrays. isnan(inArray) - ANSreturns a logical array nanArray, of the same size as inArray. The value at nanArray(index) is true when inArray(index) is NaN. Otherwise, the values are false. isnan(x) - ANSReturns true if x is NaN (Not-a-Number); otherwise, returns false. isnumeric(inArray) - ANStests for numeric array. isprime(inArray) - ANSreturns a logical array primeArray, of the same size as inArray. The value at primeArray(index) is true when inArray(index) is a prime number. Otherwise, the values are false. isreal(inArray) - ANStests for real array. isscalar(inArray) - ANStests for scalar type isspace - ANSReturns an array the same length as the string containing 1 where elements of the string are white spaces and 0 where they are not. isspace(charVecIn) - ANSfinds all whitespace characters (i.e. blanks/spaces, newline, carriage return, tab, vertical tab, or form-feed characters) in the character vector charVecIn. Returns an array the same size as charArrayIn containing logical true (1) at indices where the elements of charVecIn are whitespace characters, and logical false (0) where they are not. isstrprop - ANSCan return the indices of all the lowercase characters in a string. isstrprop(stringin,categoryString) - ANSreturns a logical array the same size as stringIn containing logical true (1) at indices where the elements of stringIn belong to the category specified in categoryString, and logical false (0) where the elements do not. If stringIn is a character array, string scalar, or numeric array, then isstrprop returns a logical array. If stringIn is a cell array of character vectors or a string array, then isstrprop returns a cell array of logical vectors. Frequently-used values for categoryStrings include: 'alpha' for elements that are alphabetic. 'alphanum' for elements that are alphanumeric. 'digit' for elements that are numbers. 'lower' for lowercase characters. 'punct' for Punctuation characters.
pi - ANSThe ratio of a circle's circumference to its diameter, about 3.1415... plot - ANSline plot plotyy - ANSLine plots with y axes on both the left and right side real number - ANSpositive or negative number that may have a factional part realmax - ANSLargest floating point number realmin - ANSsmallest floating point number repmat(A,B,C) - ANSThe function _________ creates a large array by replicating (tiling) a smaller array. arrayOut consists of an mRow-by-nCol tiling of copies of subarrayIn. reshape (arrayIn,numRow,numCol) - ANSThe function _______ returns array reshapeOut with dimensions numRow × numCols. The elements of reshapeOut are taken column-wise from the input array argument arrayIn. rot90(A) - ANSRotates array by 90 degrees counter clockwise around element at index (1,1) save dataY y - ANSSuppose the workspace consists of only two variables x = [3, -1, 4] and y = 98.6. Write a command on the command line that only saves the variable y to the file dataY. Do not include the .mat extension. script - ANSa sequence of statements stored in a text file. MATLAB® requires that the name of a script file must end in .m, in order to be executable by the MATLAB interpreter. sec - ANSsecant semilogx - ANSLine plot with logarithmic x and linear y axes semilogy - ANSLine plot with linear x and logarithmic y axes signed 32-bit integer - ANSint signed 8-bit integer - ANSint signed integer - ANSrepresents both positive and negative integer values sin - ANSSine sind - ANSSine of argument in degrees
sinh - ANShyperbolic sine size - ANSrow x column size( ) - ANSreturns the number of rows and number of columns (nRow, nCol) of the array inArray. If only the row dimension is needed, then the programmer should use size(inArray,1). If only the column dimension is needed, then the programmer should use size(inArray,2). size(inputArray) - ANSreturns the size of each dimension of inputArray sort(inArray) - ANSsorts the elements of inArray in ascending order and returns the result in sortOut. For 2D arrays, sort(inArray) sorts each column of inArray in ascending order. To achieve descending order, the function call is sort(inArray,'descend'). sortrows(inArray,colRef) - ANSsorts the array inArray based on the values in column colRef while keeping the rows together. For any rows that have equal elements in a particular column, sorting is based on the column immediately to the right. sprintf(formatSpec,arrayIn1,...,arrayInN) - ANSformats the data in arrays arrayIn1, ..., arrayInN according to the formatSpec, a string scalar, in column order, and returns the results to string scalar stringOut. The sprintf function returns only a string scalar (if the formatSpec is a string scalar) or a character vector (if the formatSpec is a character vector). sqrt - ANSsquare root stairs - ANSstair step graph startsWith(String1, TestPattern) - ANSperforms case-sensitive logical comparison returning 1 (true) if scalar array string1 starts with the specified testPattern, and returns 0 (false) otherwise. If testPattern is a string array containing multiple patterns, then startsWith returns 1 if string1 starts with any element of testPattern. startsWith(string1, testPattern, 'IgnoreCase', true) ignores case when determining if string1 starts with testPattern. strcmp(string1, string2) - ANSperforms case-sensitive comparison between two strings for equality. If the strings are equal, they must have the same content and length. The input arguments can be any combination of string arrays, character vectors, and cell arrays of character vectors. strcmpi(string1,string2) - ANSperforms case-insensitive comparison between string and string2 for equality. If the strings are equal, they must have the same content (independent of case) and length. The input arguments string1 and string2 can be any combination of string arrays, character vectors, and cell arrays of character vectors.
tanh, sech, csch, coth, - ANStrig functions that are hyperbolic The final number is: - ANSfprintf('The final number is:'); tril(A) - ANSReturns the lower triangular part of an array. triu(A) - ANSReturns the upper triangular part of an array True - ANSThe default MATLAB floating-point representation can represent various numbers from -1.79e+308 to +1.79e+308. unsigned 16-bit integer - ANSuint unsigned integer - ANSrepresents only non-negative integers. who - ANSPrints all variables in the current workspace whos - ANSPrints all variables in the current workspace as well as some extra information about their size, bytes, class, etc will always be displayed - ANSPrecision is the number of digits to the right of the decimal point that __________. xor(a,b) - ANSExclusive or returns true if a is true or b is true but not both, i.e., if exactly one of a or b is true. Also known as or xor (the x comes from eXclusive). xor(one, two) - ANSone or two but not both