FALLSEM2019-20 MAT2002 ELA VL2019201000472 Reference Material I 29-Aug-2019 EXP 3A
FALLSEM2019-20 MAT2002 ELA VL2019201000472 Reference Material I 29-Aug-2019 EXP 3A
FALLSEM2019-20 MAT2002 ELA VL2019201000472 Reference Material I 29-Aug-2019 EXP 3A
d2y dy
F ( D) y 2
p ( x) q ( x) y f ( x) (1)
dx dx
yc ( x) C1 y1 C2 y2 (2)
Then by the method of variation of parameters the particular integral of (1) is of the form
where the parameters C1 , C2 of (2) are replaced with functions u (x) , v(x) given by
y2 f ( x) y f ( x)
u ( x) dx and v( x) 1 dx ,
W ( x) W ( x)
y1 y2
where the wronskian W ( x) y1 y2 ' y2 y1 ' 0 .
y1 ' y2 '
MATLAB Code:
clear all
close all
clc
syms c1 c2 x m
F=input('Enter the coefficients [a,b,c]: ');
f=input('Enter the RHS function f(x): ');
a=F(1);b=F(2);c=F(3);
AE=a*m^2+b*m+c; % Auxilliary Equation
m=solve(AE);
m1=m(1); m2=m(2);
D=b^2-4*a*c;
if(D>0) % Roots are real and different
y1=exp(m1*x);y2=exp(m2*x);
elseif (D==0)% Roots are real and equal
Example 2. Find the general solution of the differential equation y y sec x tan x .
Solution: The differential equation pertaining the motion of the spring described by the
d 2x dx
differential equation m 2
c ky 0 .
dt dt
25.6
Given mass m 2 , spring constant k 128 , damping constant c 40 .
0 .2
d 2x dx
Therefore, the differential equation is 2
20 64 x 0 with x(0) 0 ; x(0) 0.6 .
dt dt
Input/Output:
Enter the coefficients [a,b,c]: [1 20 64]
Enter the RHS function f(x): 0
If the problem has initial conditions then enter 1 else enter 2: 1
Enter the initial conditions [x0, y(x0), Dy(x0)]:[0 0 0.6]
The complete solution is
(exp(-16*x)*(exp(12*x) - 1))/20
Example 4: Consider the above problem with the spring constant c 14 , other parameters
being the same.
Input/Output:
Enter the coefficients [a,b,c]: [1 7 64]
Enter the RHS function f(x): 0
If the problem has initial conditions then enter 1 else enter 2: 1
Enter the initial conditions [x0, y(x0), Dy(x0)]:[0 0 0.6]
The complete solution is
(2*23^(1/2)*exp(-(7*x)/2)*sin((3*23^(1/2)*x)/2))/115
Example 5: Find the charge in the RLC circuit at time t in the circuit when a resistance of
40 , inductance of 1H and a capacitance of 16 10 4 F are connected in series with a
source of voltage E (t ) 100 cos10t , given that initially the charge and current are both 0.
1
LQ RQ Q E (t )
C
Input/Output
Enter the coefficients [a,b,c]: [1,40,625]
Enter the RHS function f(x): 100*cos(10*x)
If the problem has initial conditions then enter 1 else enter 2: 1
Enter the initial conditions [x0, y(x0), Dy(x0)]:[0,0,0]
Exercise:
3. Find the current I(t) in an RLC circuit with R=11Ω, L=0.1 H, C=10-2 F , which is
connected to a source of voltage E(t) = 100 sin400t. Assume that the current and the
charge are zero when t=0.
4. A spring with mass of 2kg has damping constant 14, and a force of 6N is required to
keep the spring stretched 0.5 m beyond its natural length. The spring is stretched 1m
beyond its natural length and then released with zero velocity. Find the position of
the mass at any time t.