summaryrefslogtreecommitdiff
path: root/Tutorial1/Scilab_code
diff options
context:
space:
mode:
authorChayan Bhawal2018-09-26 20:40:17 +0530
committerChayan Bhawal2018-09-26 20:40:17 +0530
commitad60e147f47b699b3d4953a1901e3c2742013e59 (patch)
treede158c2f17dbd3ca479833a59064fa6d7c15642d /Tutorial1/Scilab_code
parent1509bacf598dcbf1e6e63db3d1f591ac57444ea1 (diff)
downloadscilab-tutorials-ad60e147f47b699b3d4953a1901e3c2742013e59.tar.gz
scilab-tutorials-ad60e147f47b699b3d4953a1901e3c2742013e59.tar.bz2
scilab-tutorials-ad60e147f47b699b3d4953a1901e3c2742013e59.zip
Tutorial1_Matrix_manipulation_script update
Diffstat (limited to 'Tutorial1/Scilab_code')
-rw-r--r--Tutorial1/Scilab_code/Tutorial1_Matrix_manipulation.sce43
1 files changed, 43 insertions, 0 deletions
diff --git a/Tutorial1/Scilab_code/Tutorial1_Matrix_manipulation.sce b/Tutorial1/Scilab_code/Tutorial1_Matrix_manipulation.sce
index b49ea0d..e4e06a6 100644
--- a/Tutorial1/Scilab_code/Tutorial1_Matrix_manipulation.sce
+++ b/Tutorial1/Scilab_code/Tutorial1_Matrix_manipulation.sce
@@ -60,3 +60,46 @@ disp(Mat_power_3, 'A^3');
Mat_power_5 = A^5;
disp(Mat_power_5,'A^5');
+
+
+//Range and size of matrices
+//Size of a matrix
+size_of_matrix = size(A);
+
+//Row and column size of a vector/matrix
+[row_size,column_size] = size(x);
+
+//Total number of elements in a matrix
+total_elements = length(A);
+
+//To extract an element of A
+Mat_element_31 = A(3,1);
+disp(Mat_element_31,'3rd row, 1st col element of A');
+
+//To extract a column of a matrix
+Mat_second_column = A(:,2);
+disp(Mat_second_column,'Second column of A');
+
+
+//To extract two columns of a matrix
+Mat_first_two_column = A(:,1:2);
+disp(Mat_first_two_column,'First two columns of A');
+
+//To extract a row of a matrix
+Mat_third_row = A(3,:);
+disp(Mat_third_row,'Third row of A');
+
+
+//Construction of special matrices
+//Identity matrix construction
+Identity_3 = eye(3,3);
+disp(Identity_3,'3 X 3 Identity matrix');
+
+//Zero matrix construction
+Zero_32 = zeros(3,2);
+disp(Zero_32,'3 X 2 Zero matrix');
+
+//All ones matrix
+Ones_45 = ones(4,5);
+disp(Ones_45,'4 X 5 all ones matrix');
+