SlideShare a Scribd company logo
ROORKEE COLLEGE OF
ENGINEERING, ROORKEE
UNDER THE GUIDANCE OF:
 Miss. RUCHITA SINGH
(Asst. Professor, EEE Dept.)
ROORKEE COLLEGE OF
ENGINEERING, ROOORKEE
BY – PRASHANT SRIVASTAV
ROLL NO. - 661020108001
B.Tech.- EEE (Vth
sem.)
INDEX
SR.NO. NAME OF PROGRAM DATE TEACHERS’REMARK
1 WAVE FORM
GENERATION
2 LINEAR CONVOLUTION
3 DESIGN OF
BUTTERWORTH FILTER:
(I) ANALOG LOW PASS FILTER
(II) DIGITAL BANDPASS
FILTER
4 AUTOCORRELATION
5 DESIGN OF CHEBYSHEV
DIGITAL FILTER
(I) TYPE – I BANDPASS
(II) TYPE – II BANDPASS
(III) TYPE –II BANDSTOP
6 FFT & IFFT WITHOUT
USING FUNCTION
7 DESIGN OF FIR FILTER BY
USING HANNING
WINDOW
8 DESIGN OF FIR FILTER BY
USING CHEBYSHEV
WINDOW
1.WAVE FORM GENERATION
COSINE WAVE
 t=0:.01:pi;
 y=cos(2*pi*t);
 subplot(2,1,1);plot (t,y);ylabel('amplitude -->');
 xlabel('(b) n -->');
GENERATION OF EXPONENTIAL SIGNAL
1. n=input('enter the length of the exponential sequence');
2. t=0:n;
3. a=input('enter the a value');
4. y2=exp(a*t);
5. subplot(2,2,4);
6. stem(t,y2);
7. ylabel('Amplitude -->');
8. xlabel('(d) n -->');
Enter the length of the exponential sequence'
Enter the a value'
GENERATION OF UNIT IMPULSE
1. t=-2:1:2;
2. y=[zeros(1,2),ones(1,1),zeros(1,2)];
3. subplot(2,2,1);
4. stem(t,y);
5. ylabel('amplitude_ _>');
6. xlabel('(a)n_ _>');
GENERATION OF UNIT STEP SEQUENCE
1. n=input('enter the N value');
2. t=0:1:n-1;
3. y1=ones(1,n);
4. subplot(2,2,2);
5. stem(t,y1);
6. ylabel('amplitude_ _>');
7. xlabel('(b)n_ _>');
enter the “n” values.
GENERATION OF RAMP SEQUENCE
1. n=input('enter the length of the ramp sequence');
2. t=0:n;
3. subplot(2,2,3);
4. stem(t,t);
5. ylabel('amplitude -->');
6. xlabel('(c) n -->');
„Enter the length of the ramp sequence'
SINE WAVE
 t=0:.01:pi;
 y=sin(2*pi*t);figure(2);
 subplot(2,1,1);plot (t,y);ylabel('amplitude -->');
 xlabel('(a) n -->');
2.LINEAR CONVOLUTION
 clc;
 clear all;
 close all;
 x=input('enter the 1st sequence');
 h=input('enter the 2nd sequence');
 y=conv(x,h);
 figure;subplot(3,1,1);
 stem(x);
 ylabel('amplitude -->');
 xlabel('(a) n -->');
 subplot(3,1,2);
 stem(h);ylabel('amplitude -->');
 xlabel('(b) n -->');
 subplot(3,1,3);
 stem(y);ylabel('amplitude -->');
 xlabel('(c) n -->');
 disp('the resultant signal is ');y
example,
1st
sequence – [1, 2]
2nd
sequence – [1, 2, 4]
3.DESIGN OF BUTTERWORTH FILTER
ANALOG LOW PASS FILTER
1. clc;
2. close all;
3. clear all;
4. format long
5. rp=input('enter the passband ripple');
6. rs=input('enter the stopband ripple');
7. wp=input('enter the passband freq');
8. ws=input('enter the stopband freq');
9. fs=input('enter the sampling freq');
10.w1=2*wp/fs;w2=2*ws/fs;
11.[n,wn]=buttord(w1,w2,rp,rs,'s');
12.[z,p,k]=butter(n,wn);
13.[b,a]=zp2tf(z,p,k);
14.[b,a]=butter(n,wn,'s');
15.w=0:.01:pi;
16.[h,om]=freqs(b,a,w);
17.m=20*log10(abs(h));
18.an=angle(h);
19.subplot(2,1,1);
20.plot(om/pi,m);
21.ylabel('Gain in dB --.');
22.xlabel('(a) Normalised frequency --.');
23.subplot(2,1,2);
24.plot(om/pi,an);
25.xlabel('(b) Normalised frequency --.');
26.ylabel('Phase in radians --.');
Example:
 enter the passband ripple 0.15
 enter the stopband ripple 60
 enter the passband freq 1500
 enter the stopband freq 3000
 enter the stopband freq 7000
DIGITAL BANDPASS FILTER
 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;
 Enter the passband ripple = 0.2
 Enter the stopband ripple = 40
 Enter the passband frequency = 1500
 Enter the stopband frequency = 2000
 Enter the sampling frequency = 9000
4.AUTO-CORRELATION
Algorithm:
1. Get the signal x(n)of length N in matrix form
2. The correlated signal is denoted as y(n)
3. y(n)is given by the formula
y(n) 5 [ ( ) ( )] x k x k n k − =−∞ ∞ ∑ where n52(N 2 1) to (N 2 1)
5.DESIGN OF CHEBYSHEV
DIGITAL FILTER
TYPE-I BAND PASS FILTER
 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;
 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
CHEBYSHEV TYPE-2 BANDSTOP FILTER
 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;
 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
CHEBYSHEV TYPE-I BANDSTOP FILTER
 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;
 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
>>
6.FFT & IFFT WITHOUT USING
FUNCTION
 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;
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
7.FIR USING HANNING WINDOW
 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
8. FIR FILTER USING
CHEBYSHEV WINDOW
 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

More Related Content

What's hot

Power delay profile,delay spread and doppler spread
Power delay profile,delay spread and doppler spreadPower delay profile,delay spread and doppler spread
Power delay profile,delay spread and doppler spreadManish Srivastava
 
Chap 5 (small scale fading)
Chap 5 (small scale fading)Chap 5 (small scale fading)
Chap 5 (small scale fading)asadkhan1327
 
Delta Modulation
Delta ModulationDelta Modulation
Delta Modulation
Nahian Ahmed
 
Windowing ofdm
Windowing ofdmWindowing ofdm
Windowing ofdm
Sreeram Reddy
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
Ahmed Diaa
 
Chap04
Chap04Chap04
Fir and iir filter_design
Fir and iir filter_designFir and iir filter_design
Fir and iir filter_designshrinivasgnaik
 
Multirate digital signal processing
Multirate digital signal processingMultirate digital signal processing
Multirate digital signal processing
MOHAN MOHAN
 
FILTER DESIGN
FILTER DESIGNFILTER DESIGN
FILTER DESIGN
naimish12
 
Phase Shift Keying & π/4 -Quadrature Phase Shift Keying
Phase Shift Keying & π/4 -Quadrature Phase Shift KeyingPhase Shift Keying & π/4 -Quadrature Phase Shift Keying
Phase Shift Keying & π/4 -Quadrature Phase Shift Keying
Naveen Jakhar, I.T.S
 
Adaptive equalization
Adaptive equalizationAdaptive equalization
Adaptive equalization
Oladapo Abiodun
 
OFDM Orthogonal Frequency Division Multiplexing
OFDM Orthogonal Frequency Division MultiplexingOFDM Orthogonal Frequency Division Multiplexing
OFDM Orthogonal Frequency Division Multiplexing
Abdullaziz Tagawy
 
Radar Systems- Unit-III : MTI and Pulse Doppler Radars
Radar Systems- Unit-III : MTI and Pulse Doppler RadarsRadar Systems- Unit-III : MTI and Pulse Doppler Radars
Radar Systems- Unit-III : MTI and Pulse Doppler Radars
VenkataRatnam14
 
MINIMUM SHIFT KEYING(MSK)
MINIMUM SHIFT KEYING(MSK)MINIMUM SHIFT KEYING(MSK)
MINIMUM SHIFT KEYING(MSK)
NARENDRA KUMAR REDDY
 
Radix-2 DIT FFT
Radix-2 DIT FFT Radix-2 DIT FFT
Radix-2 DIT FFT
Sarang Joshi
 
Dsp algorithms 02
Dsp algorithms 02Dsp algorithms 02
Dsp algorithms 02
P V Krishna Mohan Gupta
 
rake reciever ppt
rake reciever pptrake reciever ppt
rake reciever ppt
Divya Shukla
 
Rayleigh Fading Channel In Mobile Digital Communication System
Rayleigh Fading Channel In Mobile Digital Communication SystemRayleigh Fading Channel In Mobile Digital Communication System
Rayleigh Fading Channel In Mobile Digital Communication System
OUM SAOKOSAL
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulation
stk_gpg
 

What's hot (20)

Power delay profile,delay spread and doppler spread
Power delay profile,delay spread and doppler spreadPower delay profile,delay spread and doppler spread
Power delay profile,delay spread and doppler spread
 
Chap 5 (small scale fading)
Chap 5 (small scale fading)Chap 5 (small scale fading)
Chap 5 (small scale fading)
 
Delta Modulation
Delta ModulationDelta Modulation
Delta Modulation
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulation
 
Windowing ofdm
Windowing ofdmWindowing ofdm
Windowing ofdm
 
M ary psk modulation
M ary psk modulationM ary psk modulation
M ary psk modulation
 
Chap04
Chap04Chap04
Chap04
 
Fir and iir filter_design
Fir and iir filter_designFir and iir filter_design
Fir and iir filter_design
 
Multirate digital signal processing
Multirate digital signal processingMultirate digital signal processing
Multirate digital signal processing
 
FILTER DESIGN
FILTER DESIGNFILTER DESIGN
FILTER DESIGN
 
Phase Shift Keying & π/4 -Quadrature Phase Shift Keying
Phase Shift Keying & π/4 -Quadrature Phase Shift KeyingPhase Shift Keying & π/4 -Quadrature Phase Shift Keying
Phase Shift Keying & π/4 -Quadrature Phase Shift Keying
 
Adaptive equalization
Adaptive equalizationAdaptive equalization
Adaptive equalization
 
OFDM Orthogonal Frequency Division Multiplexing
OFDM Orthogonal Frequency Division MultiplexingOFDM Orthogonal Frequency Division Multiplexing
OFDM Orthogonal Frequency Division Multiplexing
 
Radar Systems- Unit-III : MTI and Pulse Doppler Radars
Radar Systems- Unit-III : MTI and Pulse Doppler RadarsRadar Systems- Unit-III : MTI and Pulse Doppler Radars
Radar Systems- Unit-III : MTI and Pulse Doppler Radars
 
MINIMUM SHIFT KEYING(MSK)
MINIMUM SHIFT KEYING(MSK)MINIMUM SHIFT KEYING(MSK)
MINIMUM SHIFT KEYING(MSK)
 
Radix-2 DIT FFT
Radix-2 DIT FFT Radix-2 DIT FFT
Radix-2 DIT FFT
 
Dsp algorithms 02
Dsp algorithms 02Dsp algorithms 02
Dsp algorithms 02
 
rake reciever ppt
rake reciever pptrake reciever ppt
rake reciever ppt
 
Rayleigh Fading Channel In Mobile Digital Communication System
Rayleigh Fading Channel In Mobile Digital Communication SystemRayleigh Fading Channel In Mobile Digital Communication System
Rayleigh Fading Channel In Mobile Digital Communication System
 
Pulse modulation
Pulse modulationPulse modulation
Pulse modulation
 

Similar to DIGITAL SIGNAL PROCESSING BASED ON MATLAB

Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-modelajaydev1111
 
Dsp manual
Dsp manualDsp manual
Dsp manual
pramod naik
 
Matlab dsp examples
Matlab dsp examplesMatlab dsp examples
Matlab dsp examples
umarjamil10000
 
Project filter matlab
Project  filter matlabProject  filter matlab
Project filter matlab
girma disasa
 
Ecg programa simulado
Ecg programa simuladoEcg programa simulado
Ecg programa simulado
Eduard Stiven Marin Montoya
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel Oscillator
Abhranil Das
 
Implementasi FIR filter menggunakan matlab
Implementasi FIR filter menggunakan matlabImplementasi FIR filter menggunakan matlab
Implementasi FIR filter menggunakan matlab
mafailmi
 
Sampling
SamplingSampling
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
Sheet 2
Sheet 2Sheet 2
Sheet 2
Ahmed Elmorsy
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1Janardhana Raju M
 
Ecg
EcgEcg
Ecg
toi_sat
 
Matlab 2
Matlab 2Matlab 2
Matlab 2asguna
 
Dsp final
Dsp finalDsp final
Pdfcode
PdfcodePdfcode
Geometric calculator with python language
Geometric calculator with python languageGeometric calculator with python language
Geometric calculator with python language
mohamedismail111079
 
Compte rendu com op touati
Compte rendu com op touatiCompte rendu com op touati
Compte rendu com op touatihamdinho
 

Similar to DIGITAL SIGNAL PROCESSING BASED ON MATLAB (20)

Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-model
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
Matlab dsp examples
Matlab dsp examplesMatlab dsp examples
Matlab dsp examples
 
Project filter matlab
Project  filter matlabProject  filter matlab
Project filter matlab
 
StewartPlatform_cpp
StewartPlatform_cppStewartPlatform_cpp
StewartPlatform_cpp
 
Ecg programa simulado
Ecg programa simuladoEcg programa simulado
Ecg programa simulado
 
The Moore-Spiegel Oscillator
The Moore-Spiegel OscillatorThe Moore-Spiegel Oscillator
The Moore-Spiegel Oscillator
 
Implementasi FIR filter menggunakan matlab
Implementasi FIR filter menggunakan matlabImplementasi FIR filter menggunakan matlab
Implementasi FIR filter menggunakan matlab
 
fhss
fhssfhss
fhss
 
Sampling
SamplingSampling
Sampling
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
Sheet 2
Sheet 2Sheet 2
Sheet 2
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1
 
Ecg
EcgEcg
Ecg
 
Design of Filters PPT
Design of Filters PPTDesign of Filters PPT
Design of Filters PPT
 
Matlab 2
Matlab 2Matlab 2
Matlab 2
 
Dsp final
Dsp finalDsp final
Dsp final
 
Pdfcode
PdfcodePdfcode
Pdfcode
 
Geometric calculator with python language
Geometric calculator with python languageGeometric calculator with python language
Geometric calculator with python language
 
Compte rendu com op touati
Compte rendu com op touatiCompte rendu com op touati
Compte rendu com op touati
 

More from Prashant Srivastav

Solar Cell presentation
Solar Cell presentationSolar Cell presentation
Solar Cell presentation
Prashant Srivastav
 
THE NATIONALISM IN EUROPE OVERVIEW
THE NATIONALISM IN EUROPE OVERVIEWTHE NATIONALISM IN EUROPE OVERVIEW
THE NATIONALISM IN EUROPE OVERVIEW
Prashant Srivastav
 
Bhel report block 4
Bhel report block 4Bhel report block 4
Bhel report block 4
Prashant Srivastav
 
IMPLEMENTATION OF NAND GATE USING NPN TRANSISTOR
IMPLEMENTATION OF NAND GATE USING NPN TRANSISTORIMPLEMENTATION OF NAND GATE USING NPN TRANSISTOR
IMPLEMENTATION OF NAND GATE USING NPN TRANSISTOR
Prashant Srivastav
 
COMPUTER RELATED GENERAL ISSUES
COMPUTER RELATED GENERAL ISSUESCOMPUTER RELATED GENERAL ISSUES
COMPUTER RELATED GENERAL ISSUES
Prashant Srivastav
 
INTRODUCTION TO NEURAL NETWORKS
INTRODUCTION TO NEURAL NETWORKSINTRODUCTION TO NEURAL NETWORKS
INTRODUCTION TO NEURAL NETWORKS
Prashant Srivastav
 
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)
Prashant Srivastav
 
SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD
SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD
SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD
Prashant Srivastav
 
Cellular system
Cellular system Cellular system
Cellular system
Prashant Srivastav
 

More from Prashant Srivastav (9)

Solar Cell presentation
Solar Cell presentationSolar Cell presentation
Solar Cell presentation
 
THE NATIONALISM IN EUROPE OVERVIEW
THE NATIONALISM IN EUROPE OVERVIEWTHE NATIONALISM IN EUROPE OVERVIEW
THE NATIONALISM IN EUROPE OVERVIEW
 
Bhel report block 4
Bhel report block 4Bhel report block 4
Bhel report block 4
 
IMPLEMENTATION OF NAND GATE USING NPN TRANSISTOR
IMPLEMENTATION OF NAND GATE USING NPN TRANSISTORIMPLEMENTATION OF NAND GATE USING NPN TRANSISTOR
IMPLEMENTATION OF NAND GATE USING NPN TRANSISTOR
 
COMPUTER RELATED GENERAL ISSUES
COMPUTER RELATED GENERAL ISSUESCOMPUTER RELATED GENERAL ISSUES
COMPUTER RELATED GENERAL ISSUES
 
INTRODUCTION TO NEURAL NETWORKS
INTRODUCTION TO NEURAL NETWORKSINTRODUCTION TO NEURAL NETWORKS
INTRODUCTION TO NEURAL NETWORKS
 
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES(CBNST)
 
SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD
SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD
SIMULATION OF PHOTO VOLTAIC CELL USING NEWTON-RAPHSON METHOD
 
Cellular system
Cellular system Cellular system
Cellular system
 

Recently uploaded

WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 

Recently uploaded (20)

WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 

DIGITAL SIGNAL PROCESSING BASED ON MATLAB

  • 1. ROORKEE COLLEGE OF ENGINEERING, ROORKEE UNDER THE GUIDANCE OF:  Miss. RUCHITA SINGH (Asst. Professor, EEE Dept.) ROORKEE COLLEGE OF ENGINEERING, ROOORKEE BY – PRASHANT SRIVASTAV ROLL NO. - 661020108001 B.Tech.- EEE (Vth sem.)
  • 2. INDEX SR.NO. NAME OF PROGRAM DATE TEACHERS’REMARK 1 WAVE FORM GENERATION 2 LINEAR CONVOLUTION 3 DESIGN OF BUTTERWORTH FILTER: (I) ANALOG LOW PASS FILTER (II) DIGITAL BANDPASS FILTER 4 AUTOCORRELATION 5 DESIGN OF CHEBYSHEV DIGITAL FILTER (I) TYPE – I BANDPASS (II) TYPE – II BANDPASS (III) TYPE –II BANDSTOP 6 FFT & IFFT WITHOUT USING FUNCTION 7 DESIGN OF FIR FILTER BY USING HANNING WINDOW 8 DESIGN OF FIR FILTER BY USING CHEBYSHEV WINDOW
  • 3. 1.WAVE FORM GENERATION COSINE WAVE  t=0:.01:pi;  y=cos(2*pi*t);  subplot(2,1,1);plot (t,y);ylabel('amplitude -->');  xlabel('(b) n -->'); GENERATION OF EXPONENTIAL SIGNAL 1. n=input('enter the length of the exponential sequence'); 2. t=0:n; 3. a=input('enter the a value'); 4. y2=exp(a*t); 5. subplot(2,2,4); 6. stem(t,y2); 7. ylabel('Amplitude -->'); 8. xlabel('(d) n -->'); Enter the length of the exponential sequence' Enter the a value'
  • 4. GENERATION OF UNIT IMPULSE 1. t=-2:1:2; 2. y=[zeros(1,2),ones(1,1),zeros(1,2)]; 3. subplot(2,2,1); 4. stem(t,y); 5. ylabel('amplitude_ _>'); 6. xlabel('(a)n_ _>'); GENERATION OF UNIT STEP SEQUENCE 1. n=input('enter the N value'); 2. t=0:1:n-1; 3. y1=ones(1,n); 4. subplot(2,2,2); 5. stem(t,y1); 6. ylabel('amplitude_ _>'); 7. xlabel('(b)n_ _>'); enter the “n” values.
  • 5. GENERATION OF RAMP SEQUENCE 1. n=input('enter the length of the ramp sequence'); 2. t=0:n; 3. subplot(2,2,3); 4. stem(t,t); 5. ylabel('amplitude -->'); 6. xlabel('(c) n -->'); „Enter the length of the ramp sequence' SINE WAVE  t=0:.01:pi;  y=sin(2*pi*t);figure(2);  subplot(2,1,1);plot (t,y);ylabel('amplitude -->');  xlabel('(a) n -->');
  • 6. 2.LINEAR CONVOLUTION  clc;  clear all;  close all;  x=input('enter the 1st sequence');  h=input('enter the 2nd sequence');  y=conv(x,h);  figure;subplot(3,1,1);  stem(x);  ylabel('amplitude -->');  xlabel('(a) n -->');  subplot(3,1,2);  stem(h);ylabel('amplitude -->');  xlabel('(b) n -->');  subplot(3,1,3);  stem(y);ylabel('amplitude -->');  xlabel('(c) n -->');  disp('the resultant signal is ');y example, 1st sequence – [1, 2] 2nd sequence – [1, 2, 4]
  • 7. 3.DESIGN OF BUTTERWORTH FILTER ANALOG LOW PASS FILTER 1. clc; 2. close all; 3. clear all; 4. format long 5. rp=input('enter the passband ripple'); 6. rs=input('enter the stopband ripple'); 7. wp=input('enter the passband freq'); 8. ws=input('enter the stopband freq'); 9. fs=input('enter the sampling freq'); 10.w1=2*wp/fs;w2=2*ws/fs; 11.[n,wn]=buttord(w1,w2,rp,rs,'s'); 12.[z,p,k]=butter(n,wn); 13.[b,a]=zp2tf(z,p,k); 14.[b,a]=butter(n,wn,'s'); 15.w=0:.01:pi; 16.[h,om]=freqs(b,a,w); 17.m=20*log10(abs(h)); 18.an=angle(h); 19.subplot(2,1,1); 20.plot(om/pi,m); 21.ylabel('Gain in dB --.'); 22.xlabel('(a) Normalised frequency --.'); 23.subplot(2,1,2); 24.plot(om/pi,an); 25.xlabel('(b) Normalised frequency --.'); 26.ylabel('Phase in radians --.'); Example:  enter the passband ripple 0.15  enter the stopband ripple 60  enter the passband freq 1500  enter the stopband freq 3000  enter the stopband freq 7000
  • 8. DIGITAL BANDPASS FILTER  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;  Enter the passband ripple = 0.2  Enter the stopband ripple = 40  Enter the passband frequency = 1500  Enter the stopband frequency = 2000  Enter the sampling frequency = 9000
  • 9. 4.AUTO-CORRELATION Algorithm: 1. Get the signal x(n)of length N in matrix form 2. The correlated signal is denoted as y(n) 3. y(n)is given by the formula y(n) 5 [ ( ) ( )] x k x k n k − =−∞ ∞ ∑ where n52(N 2 1) to (N 2 1)
  • 10. 5.DESIGN OF CHEBYSHEV DIGITAL FILTER TYPE-I BAND PASS FILTER  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;  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
  • 11. CHEBYSHEV TYPE-2 BANDSTOP FILTER  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;  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
  • 12. CHEBYSHEV TYPE-I BANDSTOP FILTER  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;  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 >>
  • 13. 6.FFT & IFFT WITHOUT USING FUNCTION  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
  • 14.  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; 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
  • 15. 7.FIR USING HANNING WINDOW  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];
  • 16.  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
  • 17. 8. FIR FILTER USING CHEBYSHEV WINDOW  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];
  • 18.  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