Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

19MIS0178

VISHAL .P

FALLSEMESTER (2021-2022)

COMPUTER NETWORK
(LAB)

DIGITAL ASSIGNMENT – IV

NAME : VISHAL.P
REG NO : 19MIS0178
SLOT : L35 + L36
CODE : MAT2002

1
19MIS0178
VISHAL .P

SOLUTION OF DIFFERENTIAL EQUATIONS BY LAPLACE


TRANSFORM TECHNIQUE

Experiment 4(A):

Introduction :

Aim:
To solve and visualize solutions of a second order Linear differential equation using Laplace
transform

2. Working Procedure

3. Procedure

2
19MIS0178
VISHAL .P

MATLAB Code:

clear
close all
clc
syms s t real
assume(s,'positive')
n=input(' Enter the order of linear equation : ');
b=input([' Enter the coefficients in 1 X ', num2str(n + 1 ) ,
' matrix : ' ] ) ;
c=input([' Enter the initial condition in 1 X ',num2str(n),'
matrix : ']);
N=0;D=0;
for i=1:n
for j=1:n-i+1
N=N+ s^(n-j)*b(i)*c(j);
end
D=D+b(i)*s^(n-i+1);
end
D=D+ b(n+1);
f (t)= input ('Enter the RHS f(t) = ');
F (s)= laplace(f);
Ys = (N+F)/D ;
y= simplify(ilaplace(Ys));
disp(['y(t)= ',char(y)]);
ezplot(y);

Example 1:

3
19MIS0178
VISHAL .P

Example 2:

4
19MIS0178
VISHAL .P

Example 3:

5
19MIS0178
VISHAL .P

Exercise 4A:

6
19MIS0178
VISHAL .P

TO FIND SOLUTION OF SYSTEM OF DIFFERENTIAL EQUATIONS

Experiment 4(B):
Slove the following the sytem of equation using matlab

Introduction:

7
19MIS0178
VISHAL .P

Matlab code
clc
clear all
syms y1(t) y2(t)
A=input('enter the coefficient matrix:');
F=input('enter the non-homogenious part:');
Y=[y1;y2];
de=diff(Y)==A*Y+F;
C=Y(0)==input('enter the conditions:');
[y1(t),y2(t)]=dsolve(de,C);
y1(t)=simplify(y1(t))
y2(t)=simplify(y2(t))
subplot(1,2,1)
ezplot(y1(t), [0,3])
subplot(1,2,2)
ezplot(y2(t), [0,3]

Example 1:

8
19MIS0178
VISHAL .P

Example 2:

9
19MIS0178
VISHAL .P

SECOND ORDER SYSTEM OF EQUATIONS:


MATLAB Code:
clc
clear
A=input('Enter A: ');
[P D]=eig(A);
Sol1 = dsolve(['D2y = ',num2str(D(1)),'*y']);
Sol2 = dsolve(['D2y = ',num2str(D(4)),'*y']);
X = P*[Sol1;Sol2];
disp('x1=');disp(X(1))
disp('x2=');disp(X(2))

Exercise 4B:

10
19MIS0178
VISHAL .P

Exercise 4B:

THANKYOU

11

You might also like