Professional Documents
Culture Documents
• Regd. No.
• Name:
• Slot: L7 + L8
• Download this sheet, and write your answers in detail neatly without any
corrections. In case of graphical answer, create the image ftle of it and paste it in
the answer, where ever needed
• Write your name and do the signature on the top of every page
• Take the snap shot of the title page and the ftlled-in answer sheet carefully which should
be clearly visible, and make a single pdf ftle only
• Then upload it through the lab log-in portal.
• Do not send different image ftles or zipped ftles. Do not send the answer sheet to my
mail
• Follow the guidelines strictly. Any deviation from the above instructions will lead to
the reduction in marks
Submission Format:
(a) Aim of the Experiment
d y
Exercise 1 (3 marks). Write a Matlab code to ftnd the solution of x2 2 + 4x d y + 2 y = eex by
Answers:
CODE
clc
clear
close all
syms x D T t C1 C2 z s
LHS=input('Enter the LHS in terms of D where D=d/dx: ');
RHS(x)=input('Enter the equation on rhs: ');
s=x;
RHSf(s)=RHS(s);
s=exp(t);
c=coeffs(LHS,D);
for i=1:length(c)
cof(i)=c(length(c)-i+1);
end
if(cof(1)==x^2 & cof(2)/coeffs(cof(2))==x)
coffinal=[coeffs(cof(1))*D*(D-1) coeffs(cof(2))*D cof(3)];
end
eqn(D)=D*0;
for i=1:length(c)
eqn(D)=eqn(D)+coffinal(i);
end
Dval=solve(eqn,D);
if(imag(Dval(1)==0))
if(ne(Dval(1),Dval(2)))
CF(t)=C1*exp(Dval(1)*t)+C2*exp(Dval(2)*t);
y1(t)=exp(Dval(1)*t);
y2(t)=exp(Dval(2)*t);
else
CF(t)=(C1+C2*t)*exp(Dval(1)*t);
y1(t)=exp(Dval(1)*t);
y2(t)=x*exp(Dval(1)*t);
end
else
CF(t)=exp(real(Dval(1))*t)*(C1*cos(imag(Dval(1)))*t+C2*sin(imag
(Dval(1))*t));
y1(t)=exp(real(Dval(1))*t)*cos(imag(Dval(1))*t);
y2(t)=exp(real(Dval(1))*t)*sin(imag(Dval(1))*t);
end
OUTPUT:
Due to inability of MATLAB to evaluate the integral, I was not able to graph the solution
Exercise 2 (3 marks). An electric circuit consists of an inductance 0.1 Heneries, a resistance
of 20 Ohms and a condenser of capacitance 25 micro-Farads. Write a Matlab code to ftnd the
charge q and the current I at any time t given that q(0) = 0.05 and I(0) = 0 (Use Laplace
Transform).
Answers:
CODE:
clc
clear
close all
syms q k s t;
L=input('Enter inductance of circuit: ');
R=input('Enter resistance of circuit: ');
C=input('Enter Capacitance of circuit: ');
OUTPUT:
I(t):
(exp(-125*t)*(125*cos(25*7^(1/2)*t)-25*7^(1/2)*sin(25*7^(1/2)*t)))/20-(25*exp(125*t)*(cos(25*7^(1/2)*t)
+ (5*7^(1/2)*sin(25*7^(1/2)*t))/7))/4