0% found this document useful (0 votes)
74 views17 pages

MATLAB

This document contains a lecture by Dr. Amit Sharma on applying differential and difference equations using MATLAB. It discusses topics like matrix formation and operations, transcendental functions, and examples of using MATLAB code to find eigenvalues and eigenvectors of matrices, check properties of determinants and eigenvalues, and plot functions. Exercises are provided to practice these concepts.

Uploaded by

AMIT SHARMA
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)
74 views17 pages

MATLAB

This document contains a lecture by Dr. Amit Sharma on applying differential and difference equations using MATLAB. It discusses topics like matrix formation and operations, transcendental functions, and examples of using MATLAB code to find eigenvalues and eigenvectors of matrices, check properties of determinants and eigenvalues, and plot functions. Exercises are provided to practice these concepts.

Uploaded by

AMIT SHARMA
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/ 17

Application of Differential and Difference

Equations (MAT2002)-MATLAB

Dr. Amit Sharma

Vellore Institute of Technology, Vellore

December 12, 2019


Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB
Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB
Matrix Formation

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Matrix Operations

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Matrix Operations

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Transcendental Functions

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Code

Q.1
Find the eigenvalues and eigenvectors of the following matrix:
 
3 4
A=
4 −3

CODE:

clc
clear
A=input(’Enter the Matrix: ’);
cf=poly(A);
disp(’Characteristic Equations’)
disp(cf)
EV=eig(A);
disp(’Eigenvalues’)
disp(EV) [P D]=eig(A);
disp(’Eigenvectors’)
disp(P)
Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB
Exercise
Find the eigenvalues and eigenvectors of the following matrix:
 
7 −2 2
A =  −2 1 4 
−2 4 1

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Code

Q.2
The product of the eigenvalues of a matrix A is equal to its
determinant.

CODE:
clc;
clear;
A=input(’Enter the Matrix:’);
detA=det(A);
disp(’Determinant of A:’)
disp(detA)
EV=eig(A);
disp(’Eigenvalues:’)
disp(EV)
prev=prod(EV);
disp(’Product of Eigenvalues:’)
disp(prev)

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Exercise 1
The sum of the eigenvalues of a matrix is the sum of the elements of
the principal diagonal.

Exercise 2
If λ is an eigenvalues of a matrix A, then λ−1 is the eigenvalue of A−1 .

Hints:
sum(eig(A))
sum(diag(A))

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB
Exercise: Find the eigenvalues of a matrix without using "eig"
command.
Hint:
charpoly(A, x)

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Plotting

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Plotting

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Plotting

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB


Plotting

Dr. Amit Sharma Application of Differential and Difference Equations (MAT2002)-MATLAB

You might also like