0% found this document useful (0 votes)
11 views4 pages

10 Linear Eqn Roots Eigen

The document outlines MATLAB programs for solving linear equations, finding eigenvalues and eigenvectors, and determining the roots of polynomials. It includes aims, objectives, and step-by-step procedures for each experiment. Students will learn to implement these mathematical concepts using MATLAB software effectively.

Uploaded by

Divyashree
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)
11 views4 pages

10 Linear Eqn Roots Eigen

The document outlines MATLAB programs for solving linear equations, finding eigenvalues and eigenvectors, and determining the roots of polynomials. It includes aims, objectives, and step-by-step procedures for each experiment. Students will learn to implement these mathematical concepts using MATLAB software effectively.

Uploaded by

Divyashree
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/ 4

SOLUTION OF LINEAR EQUATIONS

AIM:-
To write matlab codes for the solution of linear equations and verify rhe result.
OBJECTIVES:-
Upon completion of this experiment the students will be able to
1. To solve various system of linear equations
2. To know left division operation
x = A\B solves the system of linear equations A*x = B. The matrices A and B must have the
same number of rows. MATLAB® displays a warning message if A is badly scaled or nearly
singular, but performs the calculation regardless.
If A is a scalar, then A\B is equivalent to A.\B.
If A is a square n-by-n matrix and B is a matrix with n rows, then x = A\B is a solution to the
equation A*x = B, if it exists.
If A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with m rows, then A\
B returns a least-squares solution to the system of equations A*x= B.
x = mldivide(A,B) is an alternative way to execute x = A\B, but is rarely used. It enables
operator overloading for classes.
Program
%solution of linear equation
clc;
clear all;
a = input('Input the matrix A \n = ');
b = input('Input the vector b \n = ');
if (rank(a) ~= rank([a b]))
disp('The system has no solution');
else
if(det(a)~=0)
x = a\b;
disp('The solution is');
disp(x);
else
disp('Determinant of A is zero; The system has infinite solutions');
end
end

PROCEDURE
1. Open MATLAB software
2. Select Desktop  Desktop layout Default; to get all relevant sub-windows on a single
window
3. Now type the following on command window
clc; clear all;
A = [1 3 5; 4 1 6; 2 7 1]
B = [5; 10; 8]
X = A\B
Y = inv(A) * B

4. Now create a script file( .m file) by selecting File  New Blank M-file
5. Type the program1 and save it as lin_eqn.m
6. Now the program can be run by either pressing F5 Key or selecting
Run command from Debug menu or by simply pressing the play button () on the debug
toolbar
7. On command window Enter the Matrices and press Enter
8. Observe and note down the Result
EIGEN VALUE AND EIGEN VECTOR OF A SQUARE MATRIX
AIM:-
Wrte matlab codes to find eigen value and eigen vector of a matrix and verify the result
OBJECTIVES:-
Upon completion of this experiment the students will be able to
1. To understand the usage of the function eig to find eigen values and eigen
vecotrs
2. To understand the basic properties of eigen values and vectors

Program
clc
clear all;
disp('this program calculates eigen values and eigen vectors');
a=input('\n enter the square matrix');
[v d]=eig(a);
[m n]=size(a);
for k=1:n
disp(['the eigen values(' num2str(k) ')is']);
disp(d(k,k));
disp(['the vector(' num2str(k) ')is']);
disp(v(:,k));
disp('press enter to continue');
pause()
end
disp('The basic property of eigen value is A*eigen vector = eigen value *&eigen vector\n\n')
for k=1:n
disp(['A*the eigen vector(' num2str(k) ')is']);
a*v(:,k)
disp(['eigen value(' num2str(k) ')*eigen vector(' num2str(k) ')is']);
d(k,k)*v(:,k)
disp('press enter to continue');
pause()
end

PROCEDURE
1. Open MATLAB software
2. Select Desktop  Desktop layout Default; to get all relevant sub-windows on a single
window
3. Now type the following on command window
clc; clear all;
A = [2 2 -3;2 1 -6; -1 -2 0]
[v d] = eig(A)

4. Now create a script file( .m file) by selecting File  New Blank M-file
5. Type the program1 and save it as eig_val.m
6. Now the program can be run by either pressing F5 Key or selecting
Run command from Debug menu or by simply pressing the play button () on the debug
toolbar
7. On command window press Enter repeatedly so that all the eigen values and vectors are
displayed
8. Observe and note down the Result
ROOTS OF A POLYNOMIAL
AIM:-
Write MATLAB codes to find the roots of a polynomial and verify the result.
OBJECTIVES:-
Upon completion of this experiment the students will be able to
1. To find the roots of a single variable polynomial with degree n using
MATLAB

Program
clc
clear all;
p=input ('enter the coefficient of the polynomial\n ');
c=roots(p);
disp('the roots of the polynomial');
disp(c);
PROCEDURE
1. Open MATLAB software
2. Select Desktop  Desktop layout Default; to get all relevant sub-windows on a single
window
3. Now type the following on command window
clc; clear all;
P = [ 5 2 1 0 1 8]
roots(P)
solve(‘5*x^5+2*x^4+x^3+x+8=0’)
4. Now create a script file( .m file) by selecting File  New Blank M-file
5. Type the program1 and save it as root_poly.m
6. Now the program can be run by either pressing F5 Key or selecting
Run command from Debug menu or by simply pressing the play button () on the debug
toolbar
7. On command window Enter the Matrices and press Enter
8. Observe and note down the Result
9. Repeat Steps 4 to 8 for other programs

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy