Professional Documents
Culture Documents
Aod Lab
Aod Lab
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
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
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
Exercise 4B:
10
19MIS0178
VISHAL .P
Exercise 4B:
THANKYOU
11