0% found this document useful (0 votes)
58 views1 page

Experiment 2:write A Program To Multiply Two Matrix Using Scilab

The document provides the code to multiply two matrices in Scilab. The code first prompts the user to input the rows and columns of the first matrix and creates an empty matrix. It then populates the matrix with user input values. This process is repeated for the second matrix. Finally, the code uses a nested for loop to iterate through the matrices and calculate the dot product of each row of the first and column of the second to populate the result matrix C with the multiplied values.

Uploaded by

Sunil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views1 page

Experiment 2:write A Program To Multiply Two Matrix Using Scilab

The document provides the code to multiply two matrices in Scilab. The code first prompts the user to input the rows and columns of the first matrix and creates an empty matrix. It then populates the matrix with user input values. This process is repeated for the second matrix. Finally, the code uses a nested for loop to iterate through the matrices and calculate the dot product of each row of the first and column of the second to populate the result matrix C with the multiplied values.

Uploaded by

Sunil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

ETMA-252

ANALYSIS AND STATISTICAL LAB

NUMERICAL

Experiment 2:Write a program to multiply two matrix using


scilab.
Code:

clc
m1=input("Enter rows of first matrix");
n1=input("Enter colomns of first matrix");
A=zeros(m1,n1);
disp("Enter first matrix row wise");
for i=1:m1
for j=1:n1
A(i,j)=input('');
end
end
disp("Your matrix is ");
disp(A);
m2=input("Enter rows of second matrix");
n2=input("Enter colomns of second matrix");
B=zeros(m2,n2);
disp("Enter second matrix row wise");
for i=1:m2
for j=1:n2
B(i,j)=input('');
end
end
disp("Your matrix is ");
disp(B);
C=zeros(m1,n2);
z=0;
for i=1:m1
for j=1:n2
for k=1:n1
z=z+A(i,k)*B(k,j);
end
C(i,j)=z;
z=0;
end
end
disp("AxB is")
disp(C)

AKASH MOHAN
04436403614

You might also like