You are on page 1of 5

NAME – ASHUTOSH KUMAR REG NO.

- 20BCE2380

ASSESSMENT - 8
%%Assessment Number 8%%
%%solution of system of ODE%%
%%%dy1 = 5y1+3y2 and dy2 = 3y1 + 5y2 + exp(t)%%%conditions
clc
clear all
close all
syms y1(t) y2(t)
A=[5 3;3 5];
B=[0;1];
Y=[y1;y2];
odes=diff(Y)==A*Y+B*exp(t);
C=Y(0)==[1;0];
[y1(t),y2(t)]=dsolve(odes,C);
y1(t)=simplify(y1(t))
y2(t)=simplify(y2(t))

OUTPUT -
%Assessment Number 8%
%%solution of 2nd order system of ODE%%
%D2x = -5x - 3y ; D2y = -3x -5y;conditions : x(0) = 1 ,
y(0) = 0
%dx(0) = 0 ; dy(0)=0 %
clc
clear all
close all
syms x(t) y(t)
A=[-5 -3 ; -3 -5]; %%%coeff of variable matrix
Y=[x;y];
de=diff(Y,2)==A*Y;
C=Y(0)==[1;0];
D=diff(Y);
E=D(0)==[0;0];
[x(t),y(t)]=dsolve(de,C,E);
x(t)=simplify(x(t))
y(t)=simplify(y(t))
fplot(x(t),[0,10])
hold on
fplot(y(t),[0,10])

OUTPUT –
%%solution of 2nd order system of ODE%%
%D2x = -5x - 3y ; D2y = 3x +5y;conditions : x(0) = 1 ,
y(0) = 0
%dx(0) = 0 ; dy(0)=0 %
clc
clear all
close all
syms x(t) y(t)
A=[-5 -3; 3 5]; %%%coeff of variable matrix
Y=[x;y];
de=diff(Y,2)==A*Y;
C=Y(0)==[1;0];
D=diff(Y);
E=D(0)==[0;0];
[x(t),y(t)]=dsolve(de,C,E);
x(t)=simplify(x(t))
y(t)=simplify(y(t))
fplot(x(t),[0,10])
hold on
fplot(y(t),[0,10])
%% ODE USING MATRIX FORM - finding the U(t) and V(t) %%
clc
clear all
close all
syms u(t) v(t)
ode1=diff(u)==0*u +v+exp(-3*t);
ode2=diff(v)== -16*u + 10*v + exp(-3*t);
odes = [ode1; ode2];
S=dsolve(odes);
uSol(t) = S.u;
vSol(t) = S.v;
[uSol(t), vSol(t)] = dsolve(odes);
cond1 = u(0)==0;
cond2 = v(0)==1;
conds = [cond1; cond2];
[uSol(t), vSol(t)] = dsolve(odes,conds);
u = simplify(uSol(t))
v = simplify(vSol(t))

Thank You

You might also like