whenever you have to store more than one value in a very definite manner, you can use matrices. In SCILAB also, you can store value of variable in matrix.
While defining the matrices, one can assign values to each of the variables initially.
For defining the matrix,
syntax : Name of the matrix=(M,N)
where, M and N are orders of matrix
Here, we have not defined initial value to the matrix elements.
If you want to define initial value to matrix elements, you can use following syntax.
syntax : Name of the matrix=🔺(M,N)
where, 🔺 depends on initial value
1. If all the elements are zero, then
Name of the matrix=zeros(M,N)
example : A=zeros(5,5)
2. If all the elements are one, then
Name of the matrix=ones(M,N)
example : A=zeros(5,5)
3. If all the elements are other than zero and one, let us say k, then
Name of the matrix=k*ones(M,N)
example : A=3*ones(5,5)
While defining the matrices, one can assign values to each of the variables initially.
For defining the matrix,
syntax : Name of the matrix=(M,N)
where, M and N are orders of matrix
Here, we have not defined initial value to the matrix elements.
If you want to define initial value to matrix elements, you can use following syntax.
syntax : Name of the matrix=🔺(M,N)
where, 🔺 depends on initial value
1. If all the elements are zero, then
Name of the matrix=zeros(M,N)
example : A=zeros(5,5)
2. If all the elements are one, then
Name of the matrix=ones(M,N)
example : A=zeros(5,5)
3. If all the elements are other than zero and one, let us say k, then
Name of the matrix=k*ones(M,N)
example : A=3*ones(5,5)
3. If the matrix is identity matrix, then
Name of the matrix=eye(M,N)
example : A=eye(5,5)
Name of the matrix=eye(M,N)
example : A=eye(5,5)
No comments:
Post a Comment