Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MATLAB Exercise 3 February 27, 2017 Objectives: To gain experience with manipula

ID: 2080180 • Letter: M

Question

MATLAB Exercise 3 February 27, 2017 Objectives: To gain experience with manipulating arrays in MATLAB. To get acquainted with MATLAB'splotting capabilities. Background: A second-order Resistor-Inductor-Capacitor (RLC) circuit is shown below. The resistance Ris in Ohms (20, the inductance Lis in Henrys (H). and the capacitance Cis in Farads (F). The voltage-current relationships for these elements are given by: di(t) dv (t) v (t) L (t) C Applying Kirchhoffs voltage law around the series circuit yields: v (r) v (t) (t) Substituting the above relationships and reamanging a bit leads to the second-order diferential equation for the capacitor voltage: R (t) d v (i) ve (t) LC LC whose solution for zero-initial conditions is: ve() in which the damping factor a (rads) and damped natural frequency co (rad s) are given by: 2L

Explanation / Answer

% in this exercise we will examine the dependence of the capacitor voltage
% time response on the resistance R (omega) for fixed capacitance, inductance
% and source voltage. The equation for capacitor voltage is given in the
% problem. so the capacitor vooltage can be calculated by...
% Name: ********

C=4*10^(-4); % C=400 uF
L=1; % L=1 H
Vin=9; % Vin=9 V
R=[10,30,50,70,90]; % in Ohms

t=0:0.0005:0.5;
a=R/(2*L);
wd=sqrt((1/(L*C))-(R.^2/(4*L^2)));

% for R=10;
P=exp(-a(1)*t);Q=cos(wd(1)*t);R=sin(wd(1)*t);
Vc1=Vin*(1-P.*(Q+a(1)*R/wd(1)));

% for R=30;
P=exp(-a(2)*t);Q=cos(wd(2)*t);R=sin(wd(2)*t);
Vc2=Vin*(1-P.*(Q+a(2)*R/wd(2)));

% for R=50;
P=exp(-a(3)*t);Q=cos(wd(3)*t);R=sin(wd(3)*t);
Vc3=Vin*(1-P.*(Q+a(3)*R/wd(3)));

% for R=70;
P=exp(-a(4)*t);Q=cos(wd(4)*t);R=sin(wd(4)*t);
Vc4=Vin*(1-P.*(Q+a(4)*R/wd(4)));

% for R=90;
P=exp(-a(5)*t);Q=cos(wd(5)*t);R=sin(wd(5)*t);
Vc5=Vin*(1-P.*(Q+a(5)*R/wd(5)));

figure;
plot(t,Vc1,'-r','linewidth',2);hold on;
plot(t,Vc2,':b','linewidth',2);hold on;
plot(t,Vc3,'--k','linewidth',2);hold on;
plot(t,Vc4,'-.c','linewidth',2);hold on;
plot(t,Vc5,'--m','linewidth',2);grid on;
legend('R=10Omega','R=30Omega','R=50Omega','R=70Omega','R=90Omega')
title('Capacitor Voltage versus Time for Different Resistance Values','fontsize',14);
xlabel('it Time (s)','fontsize',14); ylabel('it Capactor Voltage V_c(t) (V)','fontsize',14);