Commit 68b2288e authored by STEPANYAN Anahit's avatar STEPANYAN Anahit
Browse files

Replace RLC_BP2.ipynb

parent 4aa217d9
%% Cell type:markdown id: tags:
# RLC BandPass Filter 2
%% Cell type:code id: tags:
``` python
from numpy import *
from math import *
```
%% Cell type:markdown id: tags:
## Electronic Circuit
<img src="./img/RLC_BP2.svg" width="300px">
%% Cell type:markdown id: tags:
* LT Spice (should be modified): [RLC_BP2.asc](./asc/RLC_BP2.asc)
* Transfer Function :
$$H(p)=?$$
$$H(p)=\frac{\frac{L}{R_1}p}{p^2LC+p\frac{R_2L+R_1L}{R_1R_2}+1}$$
%% Cell type:markdown id: tags:
## Parameter Identification
The function `compute_parameters` evaluates the filter parameters from the filter components.
%% Cell type:code id: tags:
``` python
def compute_parameters(R1,R2,L,C):
# compute your parameter here
w0 = 0
f0 = 0
m = 0
Ti = 0
Tmax = 0
BP = 0
w0 = 1/sqrt(L*C)
f0 = 1/sqrt(4*pi**2*L*C)
m = 0.5*L*(R2+R1)*1/(R1*R2*sqrt(L*C))
Ti = L/(R1*sqrt(L*C))
Tmax = R2/(R1+R2)
BP = (R1+R2)/(C*R1*R2*2*pi)
return {"w0":w0,"f0":f0,"m":m,"Ti":Ti,"Tmax":Tmax,"BP":BP}
# example
R1, R2, L, C = 10000, 12000, 4.7*(10**-2), 10**-8
parameters = compute_parameters(R1,R2,L,C)
print(parameters)
```
%% Output
{'w0': 0, 'f0': 0, 'm': 0, 'Ti': 0, 'Tmax': 0, 'BP': 0}
{'w0': 46126.56040144425, 'f0': 7341.2700957167335, 'm': 0.19872859772955567, 'Ti': 0.216794833886788, 'Tmax': 0.5454545454545454, 'BP': 2917.8406233514147}
%% Cell type:markdown id: tags:
## Component Selection
The function `compute_component` compute the filter components from some filter specification.
%% Cell type:code id: tags:
``` python
def compute_component(f0,BP,Tmax):
# compute your component here
R1 = 0
R2 = 0
L = 0
C = 0
R2 = 12000
R1 = R2/Tmax-R2
C = (R1+R2)/(BP*R1*R2*2*pi)
L = 1/(f0**2*4*pi**2*C)
return {"R1":R1,"R2":R2,"L":L,"C":C}
# example
f0, BP, Tmax = 0, 0, 0
f0, BP, Tmax = 7341.2700957167335, 2917.8406233514147, 0.5454545454545454
components = compute_component(f0,BP,Tmax)
print(components)
```
%% Output
{'R1': 0, 'R2': 0, 'L': 0, 'C': 0}
{'R1': 10000.0, 'R2': 12000, 'L': 0.047, 'C': 9.999999999999999e-09}
%% Cell type:code id: tags:
``` python
```
%% Cell type:code id: tags:
``` python
```
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment