Professional Documents
Culture Documents
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)
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-
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.