Finding the bandwidth of a parallel RLC circuit (+MATLAB)

Click For Summary
SUMMARY

The discussion focuses on calculating the bandwidth of a parallel RLC circuit using MATLAB. The total impedance is derived from the formula $$\frac{1}{Z_T}=\frac{1}{Z_R}+\frac{1}{Z_C}+\frac{1}{Z_L}$$, leading to the expression $$Z_T=\frac{2\pi fRLj }{2\pi fLj-RCL(2\pi f)^2+R}$$ with given values of $L=10\ \mu H$, $C=5\ pF$, and $R=10^6\ \Omega$. The user encountered issues with varying the number of frequency samples (N), which affected the calculated bandwidth, but resolved the problem after identifying an error in their MATLAB code.

PREREQUISITES
  • Understanding of RLC circuit theory
  • Familiarity with complex impedance calculations
  • Proficiency in MATLAB programming
  • Knowledge of frequency response analysis
NEXT STEPS
  • Explore MATLAB functions for frequency response analysis
  • Learn about the significance of the -3dB points in bandwidth calculations
  • Investigate the effects of sample size on numerical accuracy in simulations
  • Study the implications of varying component values in RLC circuits
USEFUL FOR

Electrical engineers, students studying circuit analysis, MATLAB users interested in signal processing, and anyone involved in bandwidth calculations for RLC circuits.

ItsTheSebbe
Messages
10
Reaction score
1
Homework Statement
upload_2018-10-1_18-36-2.png

The attempt at a solution
Constructing the total impedance of the circuit as follows,
$$\frac{1}{Z_T}=\frac{1}{Z_R}+\frac{1}{Z_C}+\frac{1}{Z_L}$$
where $Z_R=R$, $Z_C=-j\frac{1}{\omega C}$ and $Z_L=j\omega L$.
$$\frac{1}{Z_T}=\frac{1}{R}+j\omega C+\frac{1}{j\omega L}$$
solving for $Z_T$ gives us,
$$Z_T=\frac{Rj\omega L}{j\omega L-RCL\omega^2+R}$$
where $\omega=2\pi f$
$$Z_T=\frac{2\pi fRLj }{2\pi fLj-RCL(2\pi f)^2+R}$$
Plotting this function over the frequencies, whilst $L=10\ \mu H$, $C=5\ pF$ and $R=10^6\ \Omega

From here, I created the following MATLAB code to find:
- The magnitude of the impedance (Z_Mag) for a range of frequencies.
- Finding the maximum of Z_mag and it's corresponding frequency.
- finding the -3db points and the frequencies that correspond to these points.
- taking the difference of said frequencies in order to calculate the bandwidth.
Code:
clear all 
close all

N=100000; %number of frequency samples
L=10*10^(-6); %inductance
C=5*10^(-12); %capacitance
R=10^6; %resistance
f=linspace(1,10^8,N); %frequency of 1 Hz to 100 MHz
df=f(2)-f(1);

Z_T=(2*pi*f*R*L*1i)./(2*pi*f*L*1i-R*C*L*(2*pi*f).^2+R); %impedance
Z_mag=abs(Z_T); %magnitude of the complex impedance

plot(f,Z_mag); %plotting the frequency against the total impedance
title('Total impedance per frequency')
xlabel('frequency')
ylabel('total impedance')

[max_Z, max_index]=max(Z_mag); %maximum value of impedance
threedb=max_Z*sqrt(2)/2; %the 3db point 

[Z_db,index_db] = min(abs(Z_mag-threedb)); %closest value and index to the 3db point
f1=index_db*df; %the first frequency at the 3db point 
%the second frequency at the 3db point (first frequency mirrored around the
%frequency at max magnitude
f2=(max_index+(max_index-index_db))*df; 

BW=abs(f2-f1); %the bandwidth

Now when I vary the N (number of frequency samples), the bandwidth I find seems to change quite drastically. Ideally, I would expect the bandwidth to asymptotically approach some value with a greater accuracy for a greater N.

I have been trying to found out what I did wrong for some time now, does anyone know where I went wrong? Thanks!
 

Attachments

  • upload_2018-10-1_18-35-59.png
    upload_2018-10-1_18-35-59.png
    53.7 KB · Views: 578
  • upload_2018-10-1_18-36-2.png
    upload_2018-10-1_18-36-2.png
    53.7 KB · Views: 1,260
Last edited:
Physics news on Phys.org
I found an error in my program, which solved the problem.
 
  • Like
Likes   Reactions: berkeman

Similar threads

Replies
19
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 21 ·
Replies
21
Views
2K
  • · Replies 3 ·
Replies
3
Views
952
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K