You are on page 1of 7

Experiment Number – Name-

Date – Sch. No. -


Sign-
1. Objective-
To design a low pass filter with given specifications:
1. For the data sampled at 1000 Hz,
2. With less than 3dB ripple in the passband.
3. Passband is defined from 0 to 40 Hz.
4. At least 60 dB of attenuation should be there in stopband.
5. Stopband is defined from 150 Hz (to ofcourse Nyquist Rate).

2. Apparatus used-
Laptop with GNU Octave software installed on it.

3. Brief Theory-
The most simple secondary low pass filter is VCVS(Voltage Controlled
Voltage Source) circuit and it is as fig. 9-2. The cutoff frequency of this
circuit is as below.
fc=1/(2π√R1R2C1C2)

Secondary VCVS Filter

The thing to be considered when designing this filter is the determination of


values for two resistances and two condensers. The easiest way is to make
R1 and R2 same and C1 and C2 same, and the cutoff frequency here is as
below.
fc=1/2πRC
This is also called equal component low pass filter. The gain of pass band is
fixed as 1.586(4dB) in case of secondary butter worth response, and this is
the only gain applied to this circuit. The cutoff frequency becomes the
response in which the filter response is 3 dB below than pass band
response. Under the cutoff frequency, the response decreases as
12dB/Octave or 20dB/decade. This filter uses OP-Amp at non-inverting
input terminal so in order for the voltage gain to be 1.586, the feedback
resistance RB should be 0.586 times of the input resistance RA. When using
5% resistances, the choices for these resistances become 27kΩ, 47kΩ each,
4. Simulation/Code-
S.No. Code Line Comment
close all
clear all
clc

pkg load signal

fs=1000;
kp=3; %pass bnd gain
ks=60; %stop bnd gain
fp=40; %pass bnd freq
fstop=150;
fp_norm=fp/(fs/2);
fs_norm=fstop/(fs/2);
ws_norm=fs_norm;
wp_norm=fp_norm;
[N,wc_norm]=buttord(wp_norm,ws_norm,kp,ks);
%order and cutoff freq
[b,a]=butter(N,wc_norm,'low'); %filter coeff
figure(1);
No_of_samples=1000;

freqz(b,a,No_of_samples,fs);

set(gca,'fontsize',35)
title('Analog domain');
xlabel('Frequency (Hz)')
ylabel('Phase')
figure(2);
freqz(b,a); %discrete filter
set(gca,'fontsize',35)
title('Discrete domain');
xlabel('Normalized Frequency (Hz)')
ylabel('Phase')
figure(3);
T=1/fs;
L=10001;
t=[0:1:(L-1)]*T;
sig1=sin(2*pi*20*t)+sin(2*pi*30*t)+sin(2*pi*40*t);
sig2=sin(2*pi*200*t)+sin(2*pi*300*t)+sin(2*pi*400*t);
sig=sig1+sig2;
subplot(2,2,1)
plot(t(1:50),sig(1:50),'linewidth',1);
set(gca,'fontsize',35)
title('Signal in DT');
xlabel('t')
ylabel('amp')
hold on;
subplot(2,2,2);
f=fs*[-floor(L/2):floor(L/2)]/L;
Y=fftshift(fft(sig));
filt_sig=abs(Y/L);

plot(f,filt_sig,'linewidth',2);
set(gca,'fontsize',35)
title('DTFT');
xlabel('f')
ylabel('amp')
hold on;
filtered_signal=filter(b,a,sig);

subplot(2,2,3);
plot(t(1:400),filtered_signal(1:400),'linewidth',1);
set(gca,'fontsize',35)
title('Filtered Signal in DT');
xlabel('t')
ylabel('amp')
hold on;
P=fftshift(fft(filtered_signal));
filt_dtft=abs(P/L);
subplot(2,2,4);
plot(f,filt_dtft,'linewidth',1);
set(gca,'fontsize',35)
title('Filtered signals DTFT ');
xlabel('f')
ylabel('amp')
figure(4);
plot(t(1:250),sig(1:250),'linewidth',1);
hold on;
plot(t(1:250),filtered_signal(1:250),'linewidth',1,' -.');
legend("Original Signal","Filtered Signal");
set(gca,'fontsize',25)
5. Results/Graphs-
Result for code 1-

Result for code 2-


Result for code 3-

Result for code 4-


6. Result & Discussion-
The Key discussion points are:
1. Cutoff Frequency
All low-pass filters are rated at a certain cutoff frequency. That is, the frequency
above which the output voltage falls below 70.7% of the input voltage. This cutoff
percentage of 70.7 is not really arbitrary, all though it may seem so at first glance.
2. Application of Low-Pass Filter
One frequent application of the capacitive low-pass filter principle is in the design
of circuits having components or sections sensitive to electrical “noise.” As
mentioned at the beginning of the last chapter, sometimes AC signals can
“couple” from one circuit to another via capacitance (Cstray) and/or mutual
inductance (Mstray) between the two sets of conductors.

7. Precautions-
1.Always use close all, clear all and cle before the beginning of every code.

2. Always use grid lines for easy and complete understanding of the signal.

8. Conclusion-
After this experiment we got a clear understanding of Low pass filters and its
characteristics and importance of phase and its distinguishable properties.

You might also like