Matlab has lots of inbuilt function. While this may make your wok easy, you may not understand the code behind it. Here a simple example is shown which plots low pass filter without inbuilt matlab function?That is without the LPF building functions and log scale plotting functions.

An ac voltage source drive a capacitor and a source resistor as shown in the figure below.

Let the capacitance(C) of the capacitor be 250nF and resistance(R) of the resistor be 50Ohm. As explained in Main points on Resonant Circuit one of the important characteristics is the Bandwidth and cutoff frequency for filters. We can calculate these values using Matlab.

The matlab code to calculate cutoff frequency and plot the gain vs frequency is below.

The gain vs frequency plot that we get is shown below,

An ac voltage source drive a capacitor and a source resistor as shown in the figure below.

Fig: RC LPF |

The matlab code to calculate cutoff frequency and plot the gain vs frequency is below.

clear clc; % LPF Rs = 50; j=sqrt(-1); C= 25*10e-9; for i=1:1e6 f(i) = i-1; fdB(i) = 10*log10(f(i)); Xc(i)=1/(j*2*pi*f(i)*C); GdB(i) = 20*log10(abs(Xc(i)/(Rs + Xc(i)))); end fc = 1/(2*pi*Rs*C); fcdB = 10*log10(fc); figure plot(fdB,GdB) xlabel('Frequency') ylabel('Gain')

The gain vs frequency plot that we get is shown below,

## No Comment to " How to plot low pass filter without inbuilt matlab function? "