Pages

Monday 7 October 2013

FFT and IFFT Without Using Function (Matlab 2013a)

Program :

clc;
clear all;
x = input('Enter the input sequence = ');
N = length(x);
for k = 1:N
y(k) = 0;
for n = 1:N
y(k) = y(k)+x(n)*exp(-1i*2*pi*(k-1)*(n-1)/N);
end
end
%code block to plot the input sequence
t = 0:N-1;
subplot(2,2,1);
stem(t,x);
ylabel('Amplitude ---->');
xlabel('n ---->');
title('Input Sequence');
grid on;
magnitude = abs(y); % Find the magnitudes of individual FFT points
disp('FFT Sequence = ');
disp(magnitude);
%code block to plot the FFT sequence
t = 0:N-1;
subplot(2,2,2);
stem(t,magnitude);
ylabel('Amplitude ---->');
xlabel('K ---->');
title('FFT Sequence');
grid on;
R = length(y);
for n = 1:R
x1(n) = 0;
for k = 1:R
    x1(n) = x1(n)+(1/R)*y(k)*exp(1i*2*pi*(k-1)*(n-1)/R);
end
end
%code block to plot the IFFT sequence
t = 0:R-1;
subplot(2,2,3);
stem(t,x1);
disp('IFFT Sequence = ');
disp(x1);
ylabel('Amplitude ---->');
xlabel('n ---->');
title('IFFT sequence');
grid on;


Output :

Enter the input sequence = [1 4 2 5 2]

FFT Sequence =
   14.0000    2.8124    4.3692    4.3692    2.8124

IFFT Sequence =
  Columns 1 through 4

   1.0000 - 0.0000i   4.0000 - 0.0000i   2.0000 - 0.0000i   5.0000 + 0.0000i

  Column 5

   2.0000 + 0.0000i


Waveforms:

  

Sunday 6 October 2013

DCT and IDCT Without Using Function (Matlab 2013a)

Program:

clc
clear all
x = input('Enter the sequence = ');
l = length(x);
for k = 1:l
    y(k) = 0;
    if (k==1)
        w(k) = 1/sqrt(l);
    else
        w(k) = sqrt(2/l);
    end       
    for n = 1:l
        y(k) = y(k)+x(n)*cos(pi*(2*n-1)*(k-1)/(2*l));
    end
    y(k) = y(k)*w(k);
end
t = 0:l-1;
subplot(2,2,1);
stem(t,x);
ylabel('Amplitude ---->');
xlabel('n ---->');
title('Input Sequence');
grid on;
magnitude = abs(y); % Find the magnitudes of individual DCT points
disp('DCT Sequence = ');
disp(magnitude);
%code block to plot the DCT sequence
t = 0:l-1;
subplot(2,2,2);
stem(t,magnitude);
ylabel('Amplitude ---->');
xlabel('K ---->');
title('DCT Sequence');
grid on;
phase = angle(y); % Find the phases of individual DCT points
disp('Phase = ');
disp(phase);
%code block to plot the phase response
t = 0:l-1;
subplot(2,2,3);
stem(t,phase);
ylabel('Phase ---->');
xlabel('K ---->');
title('Phase Response');
grid on;
for n = 1:l
    X(n) = 0;
    if (n==1)
        w(n) = 1/sqrt(l);
    else
        w(n) = sqrt(2/l);
    end        
    for k = 1:l
        X(n) = X(n)+w(k)*y(k)*cos(pi*(2*n-1)*(k-1)/(2*l));
    end
end
t = 0:l-1;
subplot(2,2,4);
stem(t,X);
disp('IDCT Sequence = ');
disp(X);
ylabel('Amplitude ---->');
xlabel('n ---->');
title('IDCT sequence');
grid on;


Output:

Enter the sequence = [2 4 3 1 2]
DCT Sequence =
    5.3666    1.1152    0.8279    1.8045    0.1208

Phase =
         0         0    3.1416    3.1416         0

IDCT Sequence =
    2.0000    4.0000    3.0000    1.0000    2.0000


Waveforms:

    

Monday 30 September 2013

Time & Frequency Response of an LTI System (Matlab 2013a)

Program:

clc;
clear all;
b = [1,-1];
a = [0.9,-2,1];
[h,w] = freqz(a,b);
subplot(2,2,1);
mag = db(abs(h));
plot(w,mag);
xlabel('Normalized Frequency ---->');
ylabel('Magnitude in dB ---->');
title('Magnitude Response');
subplot(2,2,2);
h2 = (angle(h)*180/pi);
plot(w,h2);
xlabel('Normalized Frequency ---->');
ylabel('Phase in degrees ---->');
title('Phase Response');
x = [1,2,3,4,5];
y = [3,8,11];
z = conv(x,y);
subplot(2,1,2);
stem(z);
xlabel('n ---->');
ylabel('x(n) ---->');
title('Time Response');


Waveform:

  

Saturday 27 April 2013

Pulse Amplitude Modulation (Matlab 2012a)

Program:

clc;
clear all;
a = input('Enter the amplitude = ');
f = input('Enter the frequency = ');
n = input('Enter the N value = ');
t = 0:0.1:n;
x1 = stem(-t/3);
x2 = sin(2*pi*f*t);
y = x1.*x2;
subplot(3,1,1);
stem(x1);
title('Impulse Signal');
ylabel('Amplitude ---->');
xlabel('n ---->');
grid on;
subplot(3,1,2)
plot(t,x2);
title('Sine Wave');
xlabel('Time ----->');
ylabel('Amplitude ----->');
grid on;
subplot(3,1,3)
stem(t,y);
title('Pulse Modulated Wave');
xlabel('Time ----->');
ylabel('Amplitude ----->');
grid on;


Output:

Enter the amplitude = 5
Enter the frequency = 1
Enter the N value = 2 

 
Waveform:



Friday 26 April 2013

FIR Filters Using Chebyshev Window (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
fp = input('Enter the passband frequency = ');
fs = input('Enter the stopband frequency = ');
f = input('Enter the sampling frequency = ');
r = input('Enter the ripple value(in dBs) = ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
if(rem(n,2)==0)
n = n+1;
end
y = chebwin(n,r);
% low-pass filter
b = fir1(n-1,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
title('Magnitude Response of LPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% high-pass filter
b = fir1(n-1,wp,'high',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
title('Magnitude Response of HPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band pass filter
wn = [wp ws];
b = fir1(n-1,wn,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
title('Magnitude Response of BPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band stop filter
b = fir1(n-1,wn,'stop',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
title('Magnitude Response of BSF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;


Output:

Enter the passband ripple = 0.03
Enter the stopband ripple = 0.02
Enter the passband frequency = 1800
Enter the stopband frequency = 2400
Enter the sampling frequency = 10000
Enter the ripple value(in dBs) = 40


Waveform:

 

FIR Filters Using Kaiser Window (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
fp = input('Enter the passband frequency = ');
fs = input('Enter the stopband frequency = ');
f = input('Enter the sampling frequency = ');
beta = input('Enter the beta value = ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
n1 = n+1;
if (rem(n,2)~=0)
n1 = n;
n = n-1;
end
y = kaiser(n1,beta);
% low-pass filter
b = fir1(n,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
title('Magnitude Response of LPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% high-pass filter
b = fir1(n,wp,'high',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
title('Magnitude Response of HPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band pass filter
wn = [wp ws];
b = fir1(n,wn,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
title('Magnitude Response of BPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band stop filter
b = fir1(n,wn,'stop',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
title('Magnitude Response of BSF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;


Output:

Enter the passband ripple = 0.02
Enter the stopband ripple = 0.01
Enter the passband frequency = 1000
Enter the stopband frequency = 1500
Enter the sampling frequency = 10000
Enter the beta value = 5.8


Waveform:

 

Thursday 25 April 2013

FIR Filters Using Hanning Window (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
fp = input('Enter the passband frequency = ');
fs = input('Enter the stopband frequency = ');
f = input('Enter the sampling frequency = ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
n1 = n+1;
if (rem(n,2)~=0)
n1 = n;
n = n-1;
end
y = hanning(n1);
% low-pass filter
b = fir1(n,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
title('Magnitude Response of LPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% high-pass filter
b = fir1(n,wp,'high',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
title('Magnitude Response of HPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band pass filter
wn = [wp ws];
b = fir1(n,wn,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
title('Magnitude Response of BPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band stop filter
b = fir1(n,wn,'stop',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
title('Magnitude Response of BSF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;


Output:

Enter the passband ripple = 0.03
Enter the stopband ripple = 0.01
Enter the passband frequency = 1400
Enter the stopband frequency = 2000
Enter the sampling frequency = 8000


Waveform:

 

FIR Filters Using Hamming Window (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
fp = input('Enter the passband frequency = ');
fs = input('Enter the stopband frequency = ');
f = input('Enter the sampling frequency = ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
n1 = n+1;
if (rem(n,2)==50)
n1 = n;
n = n-1;
end
y = hamming(n1);
% low-pass filter
b = fir1(n,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
title('Magnitude Response of LPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% high-pass filter
b = fir1(n,wp,'high',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
title('Magnitude Response of HPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band pass filter
wn = [wp ws];
b = fir1(n,wn,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
title('Magnitude Response of BPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band stop filter
b = fir1(n,wn,'stop',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
title('Magnitude Response of BSF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;


Output:

Enter the passband ripple = 0.02
Enter the stopband ripple = 0.01
Enter the passband frequency = 1200
Enter the stopband frequency = 1700
Enter the sampling frequency = 9000


Waveform:

 

FIR Filters Using Blackman Window (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
fp = input('Enter the passband frequency = ');
fs = input('Enter the stopband frequency = ');
f = input('Enter the sampling frequency = ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
n1 = n+1;
if (rem(n,2)==50)
n1 = n;
n = n-1;
end
y = blackman(n1);
% low-pass filter
b = fir1(n,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
title('Magnitude Response of LPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% high-pass filter
b = fir1(n,wp,'high',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
title('Magnitude Response of HPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band pass filter
wn = [wp ws];
b = fir1(n,wn,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
title('Magnitude Response of BPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band stop filter
b = fir1(n,wn,'stop',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
title('Magnitude Response of BSF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;


Output:

Enter the passband ripple = 0.03
Enter the stopband ripple = 0.01
Enter the passband frequency = 2000
Enter the stopband frequency = 2500
Enter the sampling frequency = 7000


Waveform:

 

FIR Filters Using Bartlett Window (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
fp = input('Enter the passband frequency = ');
fs = input('Enter the stopband frequency = ');
f = input('Enter the sampling frequency = ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
n1 = n+1;
if (rem(n,2)==50)
n1 = n;
n = n-1;
end
y = bartlett(n1);
% low-pass filter
b = fir1(n,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
title('Magnitude Response of LPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% high-pass filter
b = fir1(n,wp,'high',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
title('Magnitude Response of HPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band pass filter
wn = [wp ws];
b = fir1(n,wn,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
title('Magnitude Response of BPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band stop filter
b = fir1(n,wn,'stop',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
title('Magnitude Response of BSF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;


Output:

Enter the passband ripple = 0.04
Enter the stopband ripple = 0.02
Enter the passband frequency = 1500
Enter the stopband frequency = 2000
Enter the sampling frequency = 8000


Waveform:

 

FIR Filters Using Rectangular Window (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
fp = input('Enter the passband frequency = ');
fs = input('Enter the stopband frequency = ');
f = input('Enter the sampling frequency = ');
wp = 2*fp/f;
ws = 2*fs/f;
num = -20*log10(sqrt(rp*rs))-13;
dem = 14.6*(fs-fp)/f;
n = ceil(num/dem);
n1 = n+1;
if (rem(n,2)==50)
n1 = n;
n = n-1;
end
y = boxcar(n1);
% low-pass filter
b = fir1(n,wp,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
title('Magnitude Response of LPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% high-pass filter
b = fir1(n,wp,'high',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
title('Magnitude Response of HPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band pass filter
wn = [wp ws];
b = fir1(n,wn,y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
title('Magnitude Response of BPF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
% band stop filter
b = fir1(n,wn,'stop',y);
[h,o] = freqz(b,1,256);
m = 20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
title('Magnitude Response of BSF');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;


Output:

Enter the passband ripple = 0.05
Enter the stopband ripple = 0.04
Enter the passband frequency = 1500
Enter the stopband frequency = 2000
Enter the sampling frequency = 9000


Waveform:

 

Chebyshev Type 2 Digital Band Stop Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb2ord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = cheby2(n,rs,wn,'stop');
w = 0:0.1/pi:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.3
Enter the stopband ripple = 46
Enter the passband frequency = 1400
Enter the stopband frequency = 2000
Enter the sampling frequency = 8000


Waveform:

 

Chebyshev Type 2 Digital Band Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb2ord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = cheby2(n,rs,wn,'bandpass');
w = 0:0.01/pi:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.4
Enter the stopband ripple = 40
Enter the passband frequency = 1400
Enter the stopband frequency = 2000
Enter the sampling frequency = 9000


Waveform:


 

Chebyshev Type 2 Digital High Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb2ord(w1,w2,rp,rs);
[b,a] = cheby2(n,rs,wn,'high');
w = 0:0.01/pi:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.25
Enter the stopband ripple = 40
Enter the passband frequency = 1400
Enter the stopband frequency = 1800
Enter the sampling frequency = 7000


Waveform:

 

Chebyshev Type 2 Digital Low Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb2ord(w1,w2,rp,rs);
[b,a] = cheby2(n,rs,wn);
w = 0:0.01:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.35
Enter the stopband ripple = 35
Enter the passband frequency = 1500
Enter the stopband frequency = 2000
Enter the sampling frequency = 8000


Waveform:

 

Chebyshev Type 1 Digital Band Stop Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb1ord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = cheby1(n,rp,wn,'stop');
w = 0:0.1/pi:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.25
Enter the stopband ripple = 40
Enter the passband frequency = 2500
Enter the stopband frequency = 2750
Enter the sampling frequency = 7000


Waveform:

 

Chebyshev Type 1 Digital Band Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb1ord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = cheby1(n,rp,wn,'bandpass');
w = 0:0.01:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.4
Enter the stopband ripple = 35
Enter the passband frequency = 2000
Enter the stopband frequency = 2500
Enter the sampling frequency = 10000


Waveform:

 

Chebyshev Type 1 Digital High Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb1ord(w1,w2,rp,rs);
[b,a] = cheby1(n,rp,wn,'high');
w = 0:0.01/pi:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.3
Enter the stopband ripple = 60
Enter the passband frequency = 1500
Enter the stopband frequency = 2000
Enter the sampling frequency = 9000


Waveform:

 

Chebyshev Type 1 Digital Low Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb1ord(w1,w2,rp,rs);
[b,a] = cheby1(n,rp,wn);
w = 0:0.01:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.2
Enter the stopband ripple = 45
Enter the passband frequency = 1300
Enter the stopband frequency = 1500
Enter the sampling frequency = 10000


Waveform:

 

Butterworth Digital Band Stop Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = buttord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = butter(n,wn,'stop');
w = 0:0.01:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.4
Enter the stopband ripple = 46
Enter the passband frequency = 1100
Enter the stopband frequency = 2200
Enter the sampling frequency = 6000


Waveform:


 

Butterworth Digital Band Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = buttord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = butter(n,wn,'bandpass');
w = 0:0.01:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;

Output:

Enter the passband ripple = 0.3
Enter the stopband ripple = 40
Enter the passband frequency = 1500
Enter the stopband frequency = 2000
Enter the sampling frequency = 9000

Waveform:


Butterworth Digital High Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = buttord(w1,w2,rp,rs);
[b,a] = butter(n,wn,'high');
w = 0:0.01:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.5
Enter the stopband ripple = 50
Enter the passband frequency = 1200
Enter the stopband frequency = 2400
Enter the sampling frequency = 10000


Waveform:

 

Butterworth Digital Low Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = buttord(w1,w2,rp,rs);
[b,a] = butter(n,wn);
w = 0:0.01:pi;
[h,om] = freqz(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.5
Enter the stopband ripple = 50
Enter the passband frequency = 1200
Enter the stopband frequency = 2400
Enter the sampling frequency = 10000


Waveform:

 

Chebyshev Type 2 Analog Band Stop Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb2ord(w1,w2,rp,rs,'s');
wn = [w1 w2];
[b,a] = cheby2(n,rs,wn,'stop','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.25
Enter the stopband ripple = 30
Enter the passband frequency = 1300
Enter the stopband frequency = 2000
Enter the sampling frequency = 8000


Waveform:

 

Chebyshev Type 2 Analog Band Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb2ord(w1,w2,rp,rs,'s');
wn = [w1 w2];
[b,a] = cheby2(n,rs,wn,'bandpass','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.37
Enter the stopband ripple = 37
Enter the passband frequency = 3000
Enter the stopband frequency = 4000
Enter the sampling frequency = 9000


Waveform:

 

Chebyshev Type 2 Analog High Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb2ord(w1,w2,rp,rs,'s');
[b,a] = cheby2(n,rs,wn,'high','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.34
Enter the stopband ripple = 34
Enter the passband frequency = 1400
Enter the stopband frequency = 1600
Enter the sampling frequency = 10000


Waveform:

 

Chebyshev Type 2 Analog Low Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb2ord(w1,w2,rp,rs,'s');
[b,a] = cheby2(n,rs,wn,'s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.4
Enter the stopband ripple = 50
Enter the passband frequency = 2000
Enter the stopband frequency = 2400
Enter the sampling frequency = 10000


Waveform:

 

Chebyshev Type 1 Analog Band Stop Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb1ord(w1,w2,rp,rs,'s');
wn = [w1 w2];
[b,a] = cheby1(n,rp,wn,'stop','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.15
Enter the stopband ripple = 30
Enter the passband frequency = 2000
Enter the stopband frequency = 2400
Enter the sampling frequency = 7000


Waveform:

 

Chebyshev Type 1 Analog Band Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = cheb1ord(w1,w2,rp,rs,'s');
wn = [w1 w2];
[b,a] = cheby1(n,rp,wn,'bandpass','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.3
Enter the stopband ripple = 40
Enter the passband frequency = 1400
Enter the stopband frequency = 2000
Enter the sampling frequency = 5000


Waveform:

 

Chebyshev Type 1 Analog High Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb1ord(w1,w2,rp,rs,'s');
[b,a] = cheby1(n,rp,wn,'high','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.29
Enter the stopband ripple = 29
Enter the passband frequency = 900
Enter the stopband frequency = 1300
Enter the sampling frequency = 7500


Waveform:

 

Chebyshev Type 1 Analog Low Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = cheb1ord(w1,w2,rp,rs,'s');
[b,a] = cheby1(n,rp,wn,'s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.23
Enter the stopband ripple = 47
Enter the passband frequency = 1300
Enter the stopband frequency = 1550
Enter the sampling frequency = 7800


Waveform:

 

Butterworth Analog Band Stop Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = buttord(w1,w2,rp,rs,'s');
wn = [w1 w2];
[b,a] = butter(n,wn,'stop','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
title('Magnitude Response');
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
grid on;
subplot(2,1,2);
plot(om/pi,an);
title('Phase Response');
xlabel('Normalised Frequency ---->');
ylabel('Phase in radians ---->');
grid on;


Output:

Enter the passband ripple = 0.28
Enter the stopband ripple = 28
Enter the passband frequency = 1000
Enter the stopband frequency = 1400
Enter the sampling frequency = 5000


Waveform:

 

Butterworth Analog Band Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n] = buttord(w1,w2,rp,rs);
wn = [w1 w2];
[b,a] = butter(n,wn,'bandpass','s');
w = 0:.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in dB ---->');
xlabel('Normalised Frequency ---->');
title('Magnitude Response');
grid on;
subplot(2,1,2);
plot(om/pi,an);
xlabel('Normalised Frequency ---->');
ylabel('Phase in Radians ---->');
title('Phase Response');
grid on;


Output:

Enter the passband ripple = 0.36
Enter the stopband ripple = 36
Enter the passband frequency = 1500
Enter the stopband frequency = 2000
Enter the sampling frequency = 6000


Waveform:

 

Monday 22 April 2013

Butterworth Analog High Pass Filter Using Function (Matlab 2012a)

Program:

clc;
clear all;
rp = input('Enter the passband ripple = ');
rs = input('Enter the stopband ripple = ');
wp = input('Enter the passband frequency = ');
ws = input('Enter the stopband frequency = ');
fs = input('Enter the sampling frequency = ');
w1 = 2*wp/fs;
w2 = 2*ws/fs;
[n,wn] = buttord(w1,w2,rp,rs,'s');
[b,a] = butter(n,wn,'high','s');
w = 0:0.01:pi;
[h,om] = freqs(b,a,w);
m = 20*log10(abs(h));
an = angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('Gain in dB ---->');
xlabel('Normalised frequency ---->');
title('Amplitude Response');
grid on;
subplot(2,1,2);
plot(om/pi,an);
xlabel('Normalised frequency ---->');
ylabel('Phase in radians ---->');
title('Phase Response');
grid on;


Output:

Enter the passband ripple = 0.2
Enter the stopband ripple = 40
Enter the passband frequency = 2000
Enter the stopband frequency = 3500
Enter the sampling frequency = 8000


Waveform: