Time Constant of RC Circuit | Matlab

Want create site? Find Free WordPress Themes and plugins.

In this tutorial, we will draw capacitor voltage for different time constants and analyze how it affects the charging time.

Let’s assume we have a capacitor of $10\mu F$ capacitance and want to draw voltage across capacitor if:

$\begin{align}  & (a)R=1k\Omega  \\ & (b)R=10k\Omega  \\ & (c)R=0.11k\Omega  \\\end{align}$

We will use the following formula to compute capacitor voltage as we saw in RC Circuit Tutorial:

${{V}_{o}}(t)={{V}_{s}}(1-{{e}^{-\frac{t}{RC}}})$

Now, let’s write a Matlab Code to calculate voltage across capacitor for different resistance values.

Matlab Code to calculate voltage across capacitor


clc;clear all;close all;
%% RC circuit Charging Analysis
%
C = 10e-6; % Capacitance 
R_1 = 1e3; % Resistance 1
Tau_1 = C*R_1; % Time Constant 1 (tau=RC)
t = 0:0.002:0.05; % Time Sampling
V_1 = 10*(1-exp(-t/Tau_1)); % Voltage Calculation 1 (formula from text)
R_2 = 10e3; % Resistance 2
Tau_2 = C*R_2; % Time Constant 2 (tau=RC)
V_2 = 10*(1-exp(-t/Tau_2)); % Voltage Calculation 2
R_3 = .1e3; % Resistance 3
Tau3 = C*R_3; % Time Constant 3 (tau=RC)
V_3 = 10*(1-exp(-t/Tau3)); % Voltage Calculation 3
%% Plotting the Results
plot(t,V_1,'r',t,V_2,'g', t,V_3,'b')
axis([0 0.06 0 12])
title('Capacitor Charging Analysis with three Time Constants')
xlabel('Time, s')
ylabel('Voltage across capacitor')

Results:

Did you find apk for android? You can find new Free Android Games and apps.

Leave a Comment