Circuito RC sinusolidale e impulsato

componenti

r = 3000. ;
c = 22 10^(-9);
τ = r c
ωT = 1/τ;
νT = 1. /(2 Pi τ)

frequenza, attenuazione e sfasamento

ν = νT
T = 1/ν
ω = 2 Pi ν
V0 = 1. ;
vg = 
        V0 Cos[ω t];
  
Vc0 = 
      V0 /Sqrt[1 + (ω/ωT)^2]
φc = ArcTan[-ω τ]
vc = 
      Vc0 Cos[ω t + φc]
  
Vr0 = Vc0 * c*ω*r
Vr0 = 
      V0/Sqrt[1 + (ωT/ω)^2]
φr = 
      ArcTan[1/(ω*τ)]
vr = Vr0 Cos[ω t  +  φr]

Tensione ai capi del generatore (ideale), C e R

Plot[{vg, vc, vr, vr + vc}, {t, 0, 
          2*T}, 
PlotStyle -> {{}, Dashing[{0.015}], 
            Dashing[{0.003, 0.03}], 
            Dashing[{0.030}]}
];

Onda quadra e sviluppo in serie di Fourier

Plot[
        UnitStep[Cos[ ω t]] - 0.5,  {t, -T, T}];

tup = T/2;
n = 200;
  
fc = Table[2/(k* Pi) Sin[k* Pi /2], {k, 1, n}];
ff = 
        Table[fc [[k]]*Cos[k* ω t],  {k, 1, n}];
fp = 
        Table[Plot[ff[[k]], {t, -T, T}, 
            DisplayFunction -> Identity], {k, 1, n}];
ftot = Apply[Plus, ff];

Show[fp, DisplayFunction -> $DisplayFunction, 
        PlotRange -> {-0.65, 0.65}];
Plot[ftot, {t, -T, T}];

Guadagno delle singole componenti (ai capi di C)

Ac = 
        Table[1/Sqrt[1 + (k*ω/ωT)^2], {k, 1, 
            n} ];
dφc = 
        Table[ArcTan[-k*ω/ωT], {k, 1, 
            n}];
ffC = 
        Table[fc[[k]]*Ac[[k]]*
            Cos[k* ω t + dφc[[k]]], {k, 1, 
            n}];
fpC = 
        Table[Plot[ffC[[k]], {t, -T, T}, 
            DisplayFunction -> Identity], {k, 1, n}];
fCtot = Apply[Plus, ffC];

Componenti filtrate e loro somma

Show[fpC, DisplayFunction -> $DisplayFunction, 
        PlotRange -> {-0.65, 0.65}];
Plot[fCtot, {t, -T, T}];