LC Circuit Analysis using Matlab

Determine the voltage across the capacitor and the current through the inductor:

Using the following formulae, we can easily obtain the voltage across the capacitor and current through an inductor for time t≥0,

${{i}_{L}}(t)=-\sqrt{\frac{C}{L}}{{V}_{c0}}\sin (\frac{1}{\sqrt{LC}}t)u(t)$

${{v}_{C}}(t)={{V}_{c0}}\cos (\frac{1}{\sqrt{LC}}t)u(t)$

Where

${{V}_{co}}=1V\text{        }\therefore \text{Capacitor Initial Voltage}$

Now, let us write Matlab code to compute voltage and current:

%LC Circuit Analysis
clear all;close all;clc
%%Circuit Parameters
L= 100e-3; %Inductance (100mH)
C=10e-6; % Capacitance (10microFarad) 
omega_o=1/sqrt(L*C); % Angular Frequency
Vco=1; % Capacitor Initial Voltage
Time=0:1e-5:15e-3; % Time Sampling
Vc=Vco.*cos(omega_o.*Time).*heaviside(Time); % Capacitor Voltage
il=-sqrt(C/L)*Vco.*sin(omega_o.*Time).*... % Inductor Current
heaviside(Time);
%%Plotting Capacitor Voltage and Current 
subplot(211)
plot(Time,Vc)
xlabel('Time (s)')
ylabel('Amplitude (V)')
title('V_C')
 
subplot(212)
plot(Time,il)
xlabel('Time (s)')
ylabel('Amplitude (A)')
title('i_L')
%=============================================

Results:

You May Also Read:

RL Circuit Analysis using Matlab

RC Circuit Analysis using Matlab

Leave a Comment