Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
5 views3 pages

Assignment 1

The document contains an assignment by SK Saim Sarkar for an IT Workshop on MATLAB, dated 10/07/2025. It includes three questions: calculating the determinant of a 3x3 matrix, finding the inverse of a matrix and comparing it with MATLAB's 'inv' function, and solving a system of linear equations using Gaussian elimination. Each question provides MATLAB code snippets along with sample inputs and outputs.

Uploaded by

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

Assignment 1

The document contains an assignment by SK Saim Sarkar for an IT Workshop on MATLAB, dated 10/07/2025. It includes three questions: calculating the determinant of a 3x3 matrix, finding the inverse of a matrix and comparing it with MATLAB's 'inv' function, and solving a system of linear equations using Gaussian elimination. Each question provides MATLAB code snippets along with sample inputs and outputs.

Uploaded by

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

Name- SK Saim Sarkar

Enrollment_Number - 12024052016076

Class_Roll_Number - 77

Stream - CSE(AIML)

Assignment-1

Subject-IT Workshop(MATLAB)

Date-10/07/2025

Question 1(a):

A=input("Enter the elements of 3x3 matrix:");

d=(A(1,1)*(A(2,2)*A(3,3) - A(2,3)*A(3,2))-A(1,2)*(A(2,1)*A(3,3) - A(2,3)*A(3,1))+A(1,3)*(A(2,1)*A(3,2) -


A(2,2)*A(3,1)))

%Finding the determinant using the inbuilt 'det()' function

d1=det(A);
disp(d);
disp(d1)

%input:
[1,2,3;4,5,6;7,8,9];
%Output:
d = 0
d1= 6.6613e-16

1(b)Take a 3x3 matrix 'A' as user input & calculate its inverse.Then compare

the result with the 'inv'fucntion

% Question 1(b):
A=input("Enter the elements of a 3x3 matrix:");

if(det(A)==0)
disp("It's a singular matrix,not invertible");

1
else
I=eye(size(A));
inva=A\I;
disp(inva);
end

%Inverse with inv function:

inva1=inv(A);
disp(inva1)

%input:
[2,-1,0;1,3,4;5,0,1];
% Output:
inva= -0.2308 -0.0769 0.3077
-1.4615 -0.1538 0.6154
1.1538 0.3846 -0.5385

inva1= -0.2308 -0.0769 0.3077


-1.4615 -0.1538 0.6154
1.1538 0.3846 -0.5385

1.(c) Find the solution of the below mentioned system linear equation using gaussian elimination process

(without using Gaussian(A,B)func)[use the Co-efficient matrix as "A"

and constant vector as "B"]

2*x+y-z=8

-3*x-y+2*z=-11

-2*x+y+2*z=-3

%The co-efficient matrix is:


A=[2,1,-1;-3,-1,2;-2,1,2];

%The vector
B=[8;-11;-3]

%Augmented Matrix
M=[A B];

M(3,:)=M(3,:)+M(1,:);
M(2,:)=2*M(2,:)-M(2,1)*M(1,:);
M(3,:)=M(3,:)-2*M(2,:);

2
z=-M(3,4);
y=2-z;
x=(8+z-y)/2;

disp(z)
disp(y)
disp(x)

%Output
z=-1;
y=3;
x=2;

You might also like