Start Discovering Solved Questions and Your Course Assignments
TextBooks Included
Solved Assignments
Asked Questions
Answered Questions
printing - matricesfor matrices the matlab unwinds the matrix column by column for illustration consider the random 2 times 3 matrix as shown
illustration of output statementsfor illustrationgtgt disphellohellogtgt disp43 64the formatted output can be printed to the screen by using the
output statements disp and fprintfthe output statements display strings and the answers of expressions and can permit for formatting or customizing
illustration of input functionfor illustrationgtgt rad inputenter the radius enter the radius 5rad 5if character or string input is preferred s
input functionthe input statements read in values from the default or standard input device in most of the systems the default input device is the
documentationit is very important that all the scripts be documented well so that the people can understand what the script does and how it
generate a scriptto generate a script click file then new and then m-file the new window will appear known as the editor to generate a new script
matlab scriptsonce a problem has been examined and the algorithm for its answer has been refined and written the algorithm then is translated into
script - matlabthe script is a series of matlab instructions which is stored in a file and saved the contents of a script can be showed in the
show the output - algorithmswhere does the output go the two possibilities are i to an external file or ii to a window on the screen based on system
compute the resultto compute the area the formula is required in this situation the area of the circle is pi multiplied by the radius squared
obtain the input - algorithmsfrom where does the input come the two possible choices would be from an external file on a disk or from the user who
algorithmsbefore writing any computer program it is very useful to first outline the steps which will be essential an algorithm is the series of
indexed empty matrixthe individual elements cannot be eliminated from matrices as matrices always have the similar number of elements in every
illustration of empty vectorsthe empty vectors can also be used to delete elements from the arrays for illustration to remove the third element from
empty vectorsan empty vector or in another words a vector which stores no values can be generated using the empty square bracketsgtgt evec evec
using functions with the vectors and matricesas matlab is written to work with the vectors and matrices the whole vector or matrix can be passed as
changing dimensionsin addition to transpose operator the matlab has some built-in functions which change the dimensions or configuration of matrices
size function - dimensions of matrixfor the matrix mat shown next it has three rows and two columns therefore the size is 3 times 2 the length is the
dimensions - matrixthe size and length functions in the matlab are used to find array dimensions length function returns the number of elements in
expand a matrixto expand a matrix an individual element could not be added as that would mean there would no longer be the similar number of values
example of linear indexingfor illustration the following substitutes the whole second row with values from a vector the whole row or column could
linear indexingthis is termed as linear indexing it is generally much better style when working with the matrices to refer to the row and column
illustration of modifying the matrix elementsif a single index is used with the matrix the matlab unwinds the matrix column by column for