VELLORE INSTITUTE
OF TECHNOLOGY
BECE301P- DIGITAL SIGNAL
PROCESSING LAB
NAME: Vivek Muthke
REG NO.: 21BEC0636
FACULTY: Prof. SANGEETHA S
TASK: 4
DATE: 09 MARCH 2023
QUESTION-1:
AIM- Design a Butterworth Low pass filter with cut off
frequency of 300 Hz and pass the signal cos(2π*100t) +
cos(2π*500t) to obtain the lower frequency component of the
same.
MATLAB CODE-
clc
fc=300;
t=0:0.001:0.05;
signal = cos(2*pi*100*t)+cos(2*pi*500*t);
plot(t,signal);
wc=2*pi*fc;
N=5;
[x,y] = butter(N,wc,'s');
h=freqs(x,y);
figure
plot(abs(h));
h1=tf(x,y);
y=lsim(signal,h1,t);
figure
plot(t,y);
MATLAB SIMULATION-
QUESTION-2:
AIM- Design a Butterworth IIR low pass filter using impulse
invariant transformation by taking T=0.1 sec to satisfy the
following specification:
Passband ripple 4.436 dB
Stopband ripple 20 dB
Passband edge freq ω = 0.35pi
stopband edge freq ω = 0.7pi
Algorithm-
1. Define all the specification.
2. Find the N using the order formula.
3. Find the numerator and denominator coefficients of
Butterworth filter using the keyword butter.
4. Convert the analog to digital using impinvar function
5. Find the transfer of digital filter
MATLAB CODE-
clc
ap=4.436;
as=20;
wp=0.35*pi;
ws=0.7*pi;
t=0.1;
wp1=wp/t;
ws1=ws/t;
l=(10.^(0.1*as)-1)^(0.5);
e=(10.^(0.1*ap)-1)^(0.5);
x=log(l/e);
y=log(ws1/wp1);
n=x/y;
N=ceil(n);
fs=100;
wc=wp1/(e)^(1/N);
[b,a]=butter(N,wc/fs);
[bz,az]=impinvar(b,a,fs);
H=impz(bz,az);
disp(bz);
disp(az);
MATLAB SIMULATION-
QUESTION-3:
AIM- Design a 6th-order lowpass Chebyshev Type I filter
with 10 dB of passband ripple and a passband edge frequency
of 300 Hz, which, for data sampled at 1000 Hz, corresponds
to 0.6π rad/sample. Plot its magnitude and phase responses.
Use it to filter a 1000-sample random signal.
MATLAB CODE-
clc
fs=1000;
wc=300;
[x,y] = cheby1(6,10,wc/fs/2);
freqz(x,y);
noise = rand(1,1000);
f=filter(x,y,noise);
%freqz(f);
MATLAB SIMULATION-
QUESTION-4:
AIM- Design a 6th-order Chebyshev Type I bandstop filter
with normalized edge frequencies of 0.2π and 0.6π rad/sample
and 5 dB of passband ripple. Plot its magnitude and phase
responses. Use it to filter random data.
MATLAB CODE-
clc
N=6;
[b,a]=cheby1(3,5,[0.22 0.6], 'stop');
%freqz(b,a);
datain = randn(1000,1);
dataout= filter(b,a,datain);
freqz(dataout);
MATLAB SIMULATION-