Filtro BP para laboratório

This commit is contained in:
2023-05-01 22:26:05 -03:00
parent 2f43d5433a
commit 28f656ad8c
10 changed files with 400415 additions and 0 deletions

2
.gitignore vendored
View File

@@ -31,3 +31,5 @@ codegen/
# Octave session info
octave-workspace
# ---> QUCS
*.dat

28
Filtro passivo/Ex_7_3.dpl Normal file
View File

@@ -0,0 +1,28 @@
<Qucs Schematic 0.0.19>
<Properties>
<View=0,0,1436,863,1,0,0>
<Grid=10,10,0>
<DataSet=Ex_7_3.dat>
<DataDisplay=Ex_7_3.sch>
<OpenDisplay=1>
<Script=Ex_7_3.m>
<RunScript=0>
<showFrame=0>
<FrameText0=Title>
<FrameText1=Drawn By:>
<FrameText2=Date:>
<FrameText3=Revision:>
</Properties>
<Symbol>
</Symbol>
<Components>
</Components>
<Wires>
</Wires>
<Diagrams>
<Rect 190 687 1109 577 3 #c0c0c0 1 10 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 "" "" "">
<"rDBVout" #0000ff 0 3 0 0 0>
</Rect>
</Diagrams>
<Paintings>
</Paintings>

92
Filtro passivo/Ex_7_3.m Normal file
View File

@@ -0,0 +1,92 @@
clear,clc
%--------- Especificações
flp = 25e3; wlp = 2*pi*flp;
fup = 35e3; wup = 2*pi*fup;
fls = 10e3; wls = 2*pi*fls;
fus = 50e3; wus = 2*pi*fus;
Rp = 0.1; %ripple
Ap = mag2db(sqrt(2));
As = 30;
Rs = 1; Rl = 1;
%--------- Ajuste da simetria das especificações
f0 = sqrt(flp*fup); w0 = 2*pi*f0;
fls = f0^2/fus
BWp = fup-flp;
BWs1 = fus-fls;
%----- determinação da ordem
epsl = sqrt(10^(0.1*Rp)-1);
wp = 1;
%--------- Procedimento iterativo para determinar a ordem
% Ap @ 1 rad/s -> Rp @ ??? rad/s
% TESTE COM As
ws = BWs1/BWp;
nteste = 0;
flag_run = true;
while flag_run
nteste = nteste+1;
OMEGA_Ap = cosh(1/nteste*(acosh(sqrt(db2mag(Ap)^2-1)/epsl)));
n = cheb1ord(1/OMEGA_Ap,ws,Rp,As,'s');
if nteste==n
flag_run = false;
end
end
n
%--------- Algoritmo de síntese
% CUIDADO: circuito provê Rp @ 1rad/s
if mod(n,2)==1
alpha = 4*Rs*Rl/(Rs+Rl)^2;
else
alpha = 4*Rs*Rl*(epsl^2+1)/(Rs+Rl)^2;
end
eta = sinh(1/n*asinh(1/epsl));
gama = sinh(1/n*asinh(sqrt(1-alpha)/epsl));
for k = 1:n
a(k) = sin( (2*k-1)*pi/2/n );
b(k) = eta^2+gama^2-2*eta*gama*cos(k*pi/n)+sin(k*pi/n)^2;
end
g(1) = 2*a(1)/(eta-gama);
for k=2:n
g(k) = 4*a(k)*a(k-1)/b(k-1)/g(k-1);
end
% g contém as reatâncias do ckt LC
% [tanh(0.5*asinh(1/epsl))^2 coth(0.5*asinh(1/epsl))^2] % teste para rede Pi ou T
% reescalonamento em frequência
% Rp @ 1 rad/s ----> Ap @ 1 rad/s
OMEGA_Ap = cosh(1/n*(acosh(sqrt(db2mag(Ap)^2-1)/epsl)));
FSF = 1/OMEGA_Ap;
g = g/FSF;
% Escolhida a configuração T
L1 = g(1); C2 = g(2); L3 = g(3);
%--------- Desnormalização
FSF = 2*pi*BWp;
Z = 50;
L1 = L1/FSF*Z
C2 = C2/FSF/Z
L3 = L3/FSF*Z
% 2) Transformação em frequência
% LP -> BP
C1 = 1/L1/w0^2
L2 = 1/C2/w0^2
C3 = 1/L3/w0^2
% Para a análise pós-projeto
Rs = 150; Rl = 300;

60
Filtro passivo/Ex_7_3.sch Normal file
View File

@@ -0,0 +1,60 @@
<Qucs Schematic 0.0.19>
<Properties>
<View=57,-295,1163,182,1.15552,0,0>
<Grid=10,10,1>
<DataSet=Ex_7_3.dat>
<DataDisplay=Ex_7_3.dpl>
<OpenDisplay=1>
<Script=>
<RunScript=0>
<showFrame=0>
<FrameText0=Título>
<FrameText1=Desenhado por:>
<FrameText2=Data:>
<FrameText3=Revisão:>
</Properties>
<Symbol>
</Symbol>
<Components>
<GND * 5 490 -50 0 0 0 0>
<Vac V1 5 160 -130 -63 -5 0 1 "1 V" 0 "1 GHz" 0 "0" 0 "0" 0>
<GND * 5 160 -60 0 0 0 0>
<.DC DC1 1 200 0 0 48 0 0 "26.85" 0 "0.001" 0 "1 pA" 0 "1 uV" 0 "no" 0 "150" 0 "no" 0 "none" 0 "CroutLU" 0>
<Eqn Eqn2 1 640 20 -32 17 0 0 "rDBVout=dB(Pr1.v)" 1 "yes" 0>
<GND * 5 1040 -200 0 0 0 0>
<GND * 5 1020 -50 0 0 0 0>
<VProbe Pr1 1 1030 -220 28 -31 0 0>
<R R10 5 230 -160 -26 15 0 0 "50" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "US" 0>
<L L4 5 340 -160 -55 12 0 0 "1.14 mH" 1 "" 0>
<C C2 5 470 -110 -122 29 0 1 "507.30 nF" 1 "" 0 "neutral" 0>
<L L2 5 520 -100 9 18 0 1 "57.06 uH" 1 "" 0>
<L L3 5 610 -160 -55 12 0 0 "1.14 mH" 1 "" 0>
<C C3 5 700 -160 -26 -41 0 2 "25.389 nF" 1 "" 0 "neutral" 0>
<R R11 5 1020 -110 15 -26 0 1 "50" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "US" 0>
<C C1 5 420 -160 -26 -41 0 2 "25.389 nF" 1 "" 0 "neutral" 0>
<.AC AC1 1 410 0 0 48 0 0 "log" 1 "1 kHz" 1 "100 kHz" 1 "200001" 1 "no" 0>
</Components>
<Wires>
<520 -160 520 -130 "" 0 0 0 "">
<520 -70 520 -50 "" 0 0 0 "">
<470 -50 490 -50 "" 0 0 0 "">
<470 -160 520 -160 "" 0 0 0 "">
<470 -160 470 -140 "" 0 0 0 "">
<470 -80 470 -50 "" 0 0 0 "">
<490 -50 520 -50 "" 0 0 0 "">
<520 -160 580 -160 "" 0 0 0 "">
<640 -160 670 -160 "" 0 0 0 "">
<730 -160 1020 -160 "" 0 0 0 "">
<450 -160 470 -160 "" 0 0 0 "">
<370 -160 390 -160 "" 0 0 0 "">
<260 -160 310 -160 "" 0 0 0 "">
<160 -160 200 -160 "" 0 0 0 "">
<160 -100 160 -60 "" 0 0 0 "">
<1020 -200 1020 -160 "" 0 0 0 "">
<1020 -160 1020 -140 "" 0 0 0 "">
<1020 -80 1020 -50 "" 0 0 0 "">
</Wires>
<Diagrams>
</Diagrams>
<Paintings>
</Paintings>

View File

@@ -0,0 +1,28 @@
<Qucs Schematic 0.0.19>
<Properties>
<View=-60,-20,1117,686,1.1,0,0>
<Grid=10,10,0>
<DataSet=Ex_7_3_comercial.dat>
<DataDisplay=Ex_7_3_comercial.sch>
<OpenDisplay=1>
<Script=Ex_7_3_comercial.m>
<RunScript=0>
<showFrame=0>
<FrameText0=Title>
<FrameText1=Drawn By:>
<FrameText2=Date:>
<FrameText3=Revision:>
</Properties>
<Symbol>
</Symbol>
<Components>
</Components>
<Wires>
</Wires>
<Diagrams>
<Rect 119 580 951 508 3 #c0c0c0 1 10 1 0 0.2 1 1 -0.1 0.5 1.1 1 -0.1 0.5 1.1 315 0 225 "" "" "">
<"rDBVout" #0000ff 0 3 0 0 0>
</Rect>
</Diagrams>
<Paintings>
</Paintings>

View File

@@ -0,0 +1,92 @@
clear,clc
%--------- Especificações
flp = 25e3; wlp = 2*pi*flp;
fup = 35e3; wup = 2*pi*fup;
fls = 10e3; wls = 2*pi*fls;
fus = 50e3; wus = 2*pi*fus;
Rp = 0.1; %ripple
Ap = mag2db(sqrt(2));
As = 30;
Rs = 1; Rl = 1;
%--------- Ajuste da simetria das especificações
f0 = sqrt(flp*fup); w0 = 2*pi*f0;
fls = f0^2/fus
BWp = fup-flp;
BWs1 = fus-fls;
%----- determinação da ordem
epsl = sqrt(10^(0.1*Rp)-1);
wp = 1;
%--------- Procedimento iterativo para determinar a ordem
% Ap @ 1 rad/s -> Rp @ ??? rad/s
% TESTE COM As
ws = BWs1/BWp;
nteste = 0;
flag_run = true;
while flag_run
nteste = nteste+1;
OMEGA_Ap = cosh(1/nteste*(acosh(sqrt(db2mag(Ap)^2-1)/epsl)));
n = cheb1ord(1/OMEGA_Ap,ws,Rp,As,'s');
if nteste==n
flag_run = false;
end
end
n
%--------- Algoritmo de síntese
% CUIDADO: circuito provê Rp @ 1rad/s
if mod(n,2)==1
alpha = 4*Rs*Rl/(Rs+Rl)^2;
else
alpha = 4*Rs*Rl*(epsl^2+1)/(Rs+Rl)^2;
end
eta = sinh(1/n*asinh(1/epsl));
gama = sinh(1/n*asinh(sqrt(1-alpha)/epsl));
for k = 1:n
a(k) = sin( (2*k-1)*pi/2/n );
b(k) = eta^2+gama^2-2*eta*gama*cos(k*pi/n)+sin(k*pi/n)^2;
end
g(1) = 2*a(1)/(eta-gama);
for k=2:n
g(k) = 4*a(k)*a(k-1)/b(k-1)/g(k-1);
end
% g contém as reatâncias do ckt LC
% [tanh(0.5*asinh(1/epsl))^2 coth(0.5*asinh(1/epsl))^2] % teste para rede Pi ou T
% reescalonamento em frequência
% Rp @ 1 rad/s ----> Ap @ 1 rad/s
OMEGA_Ap = cosh(1/n*(acosh(sqrt(db2mag(Ap)^2-1)/epsl)));
FSF = 1/OMEGA_Ap;
g = g/FSF;
% Escolhida a configuração T
L1 = g(1); C2 = g(2); L3 = g(3);
%--------- Desnormalização
FSF = 2*pi*BWp;
Z = 47;
L1 = L1/FSF*Z
C2 = C2/FSF/Z
L3 = L3/FSF*Z
% 2) Transformação em frequência
% LP -> BP
C1 = 1/L1/w0^2
L2 = 1/C2/w0^2
C3 = 1/L3/w0^2
% Para a análise pós-projeto
Rs = 150; Rl = 300;

View File

@@ -0,0 +1,68 @@
<Qucs Schematic 0.0.19>
<Properties>
<View=57,-295,1163,484,1.15552,0,0>
<Grid=10,10,1>
<DataSet=Ex_7_3_comercial.dat>
<DataDisplay=Ex_7_3_comercial.dpl>
<OpenDisplay=1>
<Script=Ex_7_3_comercial.m>
<RunScript=0>
<showFrame=0>
<FrameText0=Título>
<FrameText1=Desenhado por:>
<FrameText2=Data:>
<FrameText3=Revisão:>
</Properties>
<Symbol>
</Symbol>
<Components>
<Vac V1 5 160 -130 -63 -5 0 1 "1 V" 0 "1 GHz" 0 "0" 0 "0" 0>
<GND * 5 160 -60 0 0 0 0>
<GND * 5 1040 -200 0 0 0 0>
<GND * 5 1020 -50 0 0 0 0>
<VProbe Pr1 1 1030 -220 28 -31 0 0>
<C C1 5 420 -160 -26 -41 0 2 "27 nF" 1 "" 0 "neutral" 0>
<R R10 5 230 -160 -26 15 0 0 "47" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "US" 0>
<R R11 5 1020 -110 15 -26 0 1 "47" 1 "26.85" 0 "0.0" 0 "0.0" 0 "26.85" 0 "US" 0>
<L L1 5 340 -160 -55 12 0 0 "1 mH" 1 "" 0>
<C C3 5 900 -160 -26 -41 0 2 "27 nF" 1 "" 0 "neutral" 0>
<L L3 5 770 -160 -55 12 0 0 "1 mH" 1 "" 0>
<C C2 5 520 -120 -122 29 0 1 "270 nF" 1 "" 0 "neutral" 0>
<L L2 5 650 -120 9 18 0 1 "27 uH" 1 "" 0>
<.DC DC1 1 200 280 0 48 0 0 "26.85" 0 "0.001" 0 "1 pA" 0 "1 uV" 0 "no" 0 "150" 0 "no" 0 "none" 0 "CroutLU" 0>
<Eqn Eqn2 1 640 300 -32 17 0 0 "rDBVout=dB(Pr1.v)" 1 "yes" 0>
<.AC AC1 1 410 280 0 48 0 0 "log" 1 "1 kHz" 1 "100 kHz" 1 "200001" 1 "no" 0>
<L L4 5 650 30 9 18 0 1 "27 uH" 1 "" 0>
<GND * 5 570 120 0 0 0 0>
<C C4 5 550 10 -122 29 0 1 "270 nF" 1 "" 0 "neutral" 0>
</Components>
<Wires>
<450 -160 520 -160 "" 0 0 0 "">
<370 -160 390 -160 "" 0 0 0 "">
<260 -160 310 -160 "" 0 0 0 "">
<160 -160 200 -160 "" 0 0 0 "">
<160 -100 160 -60 "" 0 0 0 "">
<1020 -200 1020 -160 "" 0 0 0 "">
<1020 -160 1020 -140 "" 0 0 0 "">
<1020 -80 1020 -50 "" 0 0 0 "">
<930 -160 1020 -160 "" 0 0 0 "">
<800 -160 870 -160 "" 0 0 0 "">
<650 -160 740 -160 "" 0 0 0 "">
<520 -160 550 -160 "" 0 0 0 "">
<520 -160 520 -150 "" 0 0 0 "">
<550 -160 650 -160 "" 0 0 0 "">
<650 -160 650 -150 "" 0 0 0 "">
<550 90 570 90 "" 0 0 0 "">
<520 -90 520 90 "" 0 0 0 "">
<520 90 550 90 "" 0 0 0 "">
<650 -90 650 0 "" 0 0 0 "">
<650 60 650 90 "" 0 0 0 "">
<570 90 650 90 "" 0 0 0 "">
<570 90 570 120 "" 0 0 0 "">
<550 -160 550 -20 "" 0 0 0 "">
<550 40 550 90 "" 0 0 0 "">
</Wires>
<Diagrams>
</Diagrams>
<Paintings>
</Paintings>

View File

@@ -0,0 +1,41 @@
clc
%------- carrega resultado da simulação no QUCS
questao = 'resultado_comercial.csv';
M = readtable(questao);
f = M(:,1).Variables;
dBVout = M(:,2).Variables;
InsLoss = mag2db(Rl/(Rs+Rl)); % Perda de inserção
maxdBVout = max(dBVout); % Mínima perda na banda de passagem
indl = find(f > flp,1,'first');
indu = find(f < fup,1,'last');
maxdBVoutPB = max(dBVout(indl:indu));
mindBVoutPB = min(dBVout(indl:indu));
figure(1)
semilogx(f(indl:indu),dBVout(indl:indu),...
[f(indl) f(indu)],(InsLoss-Ap)*[1 1],...
[f(indl) f(indu)],maxdBVoutPB*[1 1],...
[f(indl) f(indu)],mindBVoutPB*[1 1])
xlabel('f (Hz)'),ylabel('dB(Vout)'),grid
title('Passband')
fprintf(1,'Minimum relative attenuation in the passband: %6.2f \n',maxdBVout-maxdBVoutPB);
fprintf(1,'Maximum relative attenuation in the passband: %6.2f \n',maxdBVout-mindBVoutPB);
fprintf(1,'Passband Ripple: %6.2f \n',maxdBVoutPB-mindBVoutPB);
indl = find(f < fls,1,'last');
indu = find(f > fus,1,'first');
figure(2)
semilogx(f(1:indl),dBVout(1:indl),...
f(indu:end),dBVout(indu:end),...
[f(1) f(end)],(InsLoss-As)*[1 1])
xlabel('f (Hz)'),ylabel('dB(Vout)'),grid
title('Stop band')
fprintf(1,'Minimum relative attenuation in the lower reject band: %6.2f \n',maxdBVout-max(dBVout(1:indl)));
fprintf(1,'Minimum relative attenuation in the upper reject band: %6.2f \n',maxdBVout-max(dBVout(indu:end)));

200002
Filtro passivo/resultado.csv Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff