0% found this document useful (0 votes)
47 views

To Find The Homogenous System of First Order and Second Order Differential Equations by Matrix Method

The document discusses using matrix methods to find homogeneous systems of first and second order differential equations, providing MATLAB code to symbolically determine the eigenvalues and eigenvectors of the system and use them to solve the equations subject to given initial conditions. It also discusses using power series methods to solve a second order differential equation, providing MATLAB code to determine the first five terms in the power series solution.

Uploaded by

krithiik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

To Find The Homogenous System of First Order and Second Order Differential Equations by Matrix Method

The document discusses using matrix methods to find homogeneous systems of first and second order differential equations, providing MATLAB code to symbolically determine the eigenvalues and eigenvectors of the system and use them to solve the equations subject to given initial conditions. It also discusses using power series methods to solve a second order differential equation, providing MATLAB code to determine the first five terms in the power series solution.

Uploaded by

krithiik
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

4A.

AIM:

To find the homogenous system of first order and second order differential
equations by matrix method.

Mathematical Background:

A differential equation is a mathematical equation for an unknown function of one


or several variables that relates the values of the function itself and of its derivatives
of various orders. A matrix differential equation contains more than one function
stacked into vector form with a matrix relating the functions to their derivatives.
4A1.
MATLAB CODE:
clc
clear all
syms k x1(t) x2(t)
A=input('enter the square matrix:');
F=input('enter the non homongenous part of Dy1 Dy2:');
inc=input('enter the y1(0) y2(0) ');
a1=A-k*eye(size(A));
char_eqn=det(a1);
eig_val=solve(char_eqn,k);
for i=1:numel(eig_val)
b1(:,i)=null(subs(a1,k,eig_val(i)));%eigen vector
end
F1=inv(b1)*F';
inc1=inv(b1)*inc';
eqn1=diff(x1,t)-eig_val(1)*x1(t)==F1(1);
cond1=x1(0)==inc1(1);
x1=dsolve(eqn1,cond1);
eqn2=diff(x2,t)-eig_val(2)*x2(t)==F1(2);%diff(fn,variable,order)
cond2=x2(0)==inc1(2);
x2=dsolve(eqn2,cond2);
Y=b1*[x1;x2];%normalise vector
disp('y1(t)=');
disp(Y(1));
disp('y2(t)=');
disp(Y(2));

OUTPUT:

4A2.
MATLABCODE:

clc
clear all
syms k t x1(t) x2(t)

A=input("Enter the matrix");


I=A-k*eye(size(A));
char_eq=det(I);
eigen_value=solve(char_eq);

for n=1:length(A)
p(:,n)=null(subs(I,k,eigen_value(n)));
end

F = input("enter non homo part");


inc = input("enter y1(0) y2(0) Dy1(0) Dy2(0): ");
F1 = inv(p)*F;
inc1 = inv(p)*[inc(1) ; inc(2)] ; %x1(0) and x2(0)
inc2 = inv(p)*[inc(3) ; inc(4)] ; %Dx1(0) and Dx2(0)
Dx1 = diff(x1,t);
Dx2 = diff(x2,t);
cond1 = [x1(0)==inc1(1),Dx1(0)==inc2(1)];
eqn1 = diff(x1,t,2)-eigen_value(1)*x1==F1(1);

x1= dsolve(eqn1,cond1);
eqn2 = diff(x2,t,2)-eigen_value(2)*x2==F1(2);
cond2 = [x2(0)==inc1(2),Dx2(0)==inc2(2)];
x2 = dsolve(eqn2,cond2);
Y = p*[x1;x2];

disp('y1(t)=');
disp(Y(1));
disp('y2(t)=');
disp(Y(2));

OUTPUT:
2.
AIM:

To find the first five terms in the power series solution of the differential equation
y’’+2y’+2y =0.

Mathematical Background:

The power series method is used to seek a power series solution to certain
differential equations. In general, such a solution assumes a power series with
unknown coefficients, then substitutes that solution into the differential equation to find
a recurrence relation for the coefficients.

MATLAB CODE:
clc
clear all;
syms x d0 d1 d2 d3 d4
coe=input('enter coeff of d2y dy and y:');
n=input('Number of terms in the series');
y=d0+d1*x+d2*x^2+d3*x^3+d4*x^4;
DE=coe(1)*diff(y,x,2)+coe(2)*diff(y,x)+coe(3)*y;
coeffs_x=fliplr(coeffs(DE,x,'All'));
d2=solve(coeffs_x(1),d2);
d3=subs(solve(coeffs_x(2),d3));
d4=subs(solve(coeffs_x(3),d4));
disp('First 5 terms in the series solution of DE:');
disp(collect(subs(y),[d0,d1]))

OUTPUT:

You might also like