Project, Math 308

advertisement
Project, Math 308
Goals: In this project you will implement a systems solver, the Runge Kutta method for systems.
You will use this method to study damped and driven oscillations in an LRC electrical circuit. You
will numerically investigate the phenomena of resonance, critical damping, and practical resonance
in this system.
An LRC circuit: The sum of the voltage drops across the elements must equal the applied
voltage, giving us the differential equation
LI ! + RI +
1
Q = E(t).
C
Recalling that I = Q! , we can turn this into a second order differential equation for Q(t) (the charge
on the capacitor)
(1)
Q!! +
R !
1
1
Q +
Q = E(t).
L
LC
L
Assignments:
1. Write the second order differential equation (1) as a system of two first order differential
equations for y1 (t) = Q(t) and y2 (t) = Q! (t).
2. If we remove the resistor from the circuit, equation (1) becomes
Q!! +
1
1
Q = E(t).
LC
L
This equation describes undamped forced oscillations. What is the natural frequency ω0 for this
system? Express L as a function of ω0 , i.e. L = L(ω0 ) = · · ·.
3. If we use the applied voltage from a wall socket, we would have E(t) = 117 sin(120πt). At
what natural frequencies of the circuit might you expect to see resonance?
4. With the resistor in the circuit, but removing the applied voltage, we have
Q!! +
R !
1
Q +
Q = 0.
L
LC
Calculate Lcr , the value of L for which the circuit is critically damped, in terms of R and C,
i.e. Lcr = Lcr (R, C) = · · ·. As you increase L from Lcr , will the circuit be underdamped or
overdamped?
Lab Problems:
By choosing different values for L, design a circuit which exhibits the following phenomena.
Solve the corresponding system using RKsys.m, and print your results. Be sure to indicate the
values of L you have used to generate each plot.
1. Solve the system of equations which correspond to (1) with no applied voltage and an initial
charge of 1 Coulomb on the capacitor and no initial current in the circuit. Choose values of L so
that the charge across the capacitor is
(a) Overdamped
(b) Underdamped
(c) Critically Damped
To better see the phenomena, plot the charge Q = y1 alone. This can be done by typing
plot(t,yRK(:,1)) in the Matlab command window. This plots the first row of the vector yRK,
which corresponds to the values of y1 . By experimenting with various values of L, length of time
interval, step size and so forth, produce plots which clearly demonstrate the desired phenomena.
2. Remove the resistor from the system, and add an applied voltage E(t) = 117 sin(120πt)
(you need to modify the file f.m). Solve the corresponding system of equations assuming no initial
charge on the capacitor and no initial current in the circuit. Choose values of L so that the charge
on the capacitor exhibits resonance.
3. Return the resistor to the circuit by modifying the appropriate parts of the file f.m. Modify
the circuit so that R = 2Ω and C = 1000µF (you need to modify the file f.m). Choose a value
for L = Lc so as to maximize the amplitude of the steady state solution that remains after the
transient solution dies out. In other words, try to create practical resonance in the system. Note
that you may need to adjust N and the length of the time interval to obtain sufficiently small h over
a sufficiently long time to see the steady state solution. (You may want to compute the exponential
1
decay rate of the transient solution.). Plot the charge as a function of time for L = Lc , L = 10
Lc
and L = 10Lc in each case over a long enough time interval to ensure that you are observing the
steady state of the circuit.
The content of f.m file
Here you will use a resistor with R = 2kΩ, a capacitor with C = 10µF and applied voltage
E(t) = 117 sin(120πt). By choosing different values of L, the inductance of the inductor in Henries,
you will be able to design a circuit which will exhibit various oscillatory phenomena.
Fist we will consider the case without an applied voltage. The function f.m may accept vectors
for input as y
function f=f(t,y)
R=2000;
C=0.00001;
L=???; %Modify the system here
f(1)=y(2); %dy1/dt
f(2)=-(R/L)*y(2)-y(1)/(L*C); %dy2/dt
The content of RKsys.m file
The following program allows you to solve systems of first order ODEs using the Runge Kutta
method
clear t
clear yRK
a=0;
b=1;
N=200;
y0=[1 0];
h=(b-a)/N;
t(1)=a;
yRK(1,:)=y0;
for i=1:N
k1=f(t(i),yRK(i,:)); %sends the vector yRK to f
k2=f(t(i)+h/2,yRK(i,:)+h*k1/2); %sends vectors yRK,k1 to f
k3=f(t(i)+h/2,yRK(i,:)+h*k2/2); %sends vectors yRK,k2 to f
k4=f(t(i)+h,yRK(i,:)+h*k3); %sends vectors yRK,k3 to f
k=(k1+2*k2+2*k3+k4)/6; %defines vector k
t(i+1)=t(i)+h;
yRK(i+1,:)= yRK(i,:)+h*k; %next column of matrix yRK
end
plot(t,yRK) %plots y1,y2 vs t
legend(’y1’,’y2’)
xlabel(’t’)
Download