Gain Vs Frequency of Band Pass Filter in Matlab without inbuilt functions | applied electronics engineering

Latest

Gain Vs Frequency of Band Pass Filter in Matlab without inbuilt functions

By Applied Electronics - Tuesday, January 17, 2017 No Comments
Gain Vs Frequency of Band Pass Filter in Matlab without inbuilt functions is shown here. It is crucial that we don't use matlab inbuilt functions before we don't understand what they are doing. It is important to students specially.

The bandpass filter circuit diagram is shown below.

Gain Vs Frequency of Band Pass Filter in Matlab without inbuilt functions
The circuit is driven by ac voltage source. The resonant circuit at the end of the source resistor is made of capacitor of capacitance of 250nF and inductor of inductance 0.5mH.

The matlab code to plot the Gain Vs Frequency or Attenuation Vs Frequency is below.

clear
clc;

% BPF

Rs = 50;
j=sqrt(-1);
L= 0.5*1e-3;
C= 25*10e-9;

for i=1:1e6
    f(i) = i-1;
    fdB(i) = 10*log10(f(i));
    Xl(i)= j*2*pi*f(i)*L;
    Xc(i)=1/(j*2*pi*f(i)*C);
    Xt(i) = (Xc(i)*Xl(i))/(Xc(i)+Xl(i));
    GdB(i) = 20*log10(abs(Xt(i)/(Rs + Xt(i))));
end

fc = 1/2*pi*sqrt(L*C);
fcdB = 10*log10(fc);

figure
plot(fdB,GdB)
xlabel('Frequency')
ylabel('Gain')

The following shows the graph as obtained from the above code.

Gain Vs Frequency of Band Pass Filter in Matlab without inbuilt functions

See also,

Tags:

No Comment to " Gain Vs Frequency of Band Pass Filter in Matlab without inbuilt functions "