User:Eml4500.f08.jamama.adam/matlabtutorial

5. Matris Building FunctionLink title

Some functions in matlab will accomplish predetermined convinient tasks for you.

Here is an example of the of a 5-by-5 matrix(B) created from an original 3-by-3 matrix(A):

disp('5. Matrix Building Function.')

A=[1 2 3;4 5 6;7 8 9]

B = [A,zeros(3,2);zeros(2,3),eye(2)]

The result in MatLab is:

5. Matrix Building Function.

A =


 * 1    2     3
 * 4    5     6
 * 7    8     9

B =


 * 1    2     3     0     0
 * 4    5     6     0     0
 * 7    8     9     0     0
 * 0    0     0     1     0
 * 0    0     0     0     1

6. For, while, if, - and relations.Link title

Examples of the use of "for", "while" and "if" in MatLab: