User:Eml4500.f08.gravy.jad/Matlab

5. Matrix Building Functions

Some commonly used functions in Matlab consists of:

For example, by saying zeros(m,n) produces an mxn matrix containing zeros. By saying zeros(n) produces an nxn matrix containing zeros. By saying zeros(A) while A is an existing matrix, it produces a matrix size A containing zeros.

6. For, if, while -and relations

For, if and while are different types of loops used in Matlab.

for:

-The "for" loop produces a vector of size "n" for a given function "x"

-saying, i=n:-1:1, will write the vector backwards

-There can be double nested "for" loops (two or more for loops in the same loop. This will produce an mxn matrix.

-A matrix can be used instead of "n" and it will assume to compute the matrix

while:

-The "while" function is a loop that will continue to loop until the condition statement becomes false

if:

-The"if" function is a single loop that will only enter the loop if the primary condition is met

-it is a single loop

Relations

Some common relational operators used in Matlab consists of:

logical operators are as follows:

In addition, any true/false relations appear as a scalar number 1/0.