Start Discovering Solved Questions and Your Course Assignments
TextBooks Included
Solved Assignments
Asked Questions
Answered Questions
refer the subset of a matrixit is also possible to refer to the subset of a matrix for illustration this refers to the first amp second rows second
referring to and modifying the matrix elementsto refer to matrix elements the row and then the column indices are given in parentheses always the row
functions to create special matricesthe matlab also has various functions which create special matrices for illustration the zeros function generates
matrices of random numbersthe matrices of random numbers can be generated using the rand and randint functions the first two arguments in the randint
creating matrix variables- argumentsthe cat arguments dimensions are not reliablethe iterators can also be used for the values on the rows by using
creating matrix variablescreating a matrix variable is actually just a generalization of creating a row and column vector variables that is the
creating column vectorsone way to generate a column vector is by explicitly putting the values in square brackets separated by the semicolonsgtgt c
example of referring elementsthe vector can also be extended for illustration the following generates a vector which has three elements and then
illustration of modifying elementsillustration the fifth element in the vector newvec is 9gtgt newvec5ans 9the subset of a vector that would be a
linspace functionlikewise the linspace function generates a linearly spaced vector linspacexyn generates a vector with n values in the inclusive
the colon operatorif the values in the vector are regularly spaced the colon operator is used to iterate through these values for illustration 15
stringsthe matlab also handles strings that are a sequence of characters in single quotes for illustration using the double function on a string will
function charthe function char does the opposite it converts from any number type to the type chargtgt charnumequivans aas the letters of the
characters and encodinga character in a matlab is represented by using single quotes example a or x the quotes are essential to denote a character
the efficient methodthough in matlab there is another built-in function which specifically produces random integers ie randint calling the function
the programming conceptin most of the programming languages random function returns a real number therefore the real number would then have to be
produce a random real numberto produce a random real number in the range from low to high at first create the variables low and high and then use the
illustrations of calling the rand functionthe function lsquorandrsquo can be used to produce random real numbers calling it produces one random real
random numberswhenever a program is being written to work with a data and the data is not yet available it is frequently useful to test the program
type logicalthe type logical is used to store the truefalse valuesif any variables have been formed in the command window they can be seen at the
typeseach and every expression or variable has a type related with it the matlab supports numerous types of values that are known as classes a class
illustration of built-in functions and helpto find out what a specific function does and how to call it type help and then the name of function
built-in functions and helpthere are lots of built-in functions in a matlab the help command is used to find out what functions matlab has and how to
operator precedence rulesa few operators have precedence over the others for illustration in the expression 4 5 3 the multiplication takes the
operatorsthere are in general two types of operators unary operators that operate on a single value or operand and binary operators that operate on