0% found this document useful (0 votes)
19 views

DSP Lab File

DSP lab file 4th year ece branch

Uploaded by

Khatugas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
19 views

DSP Lab File

DSP lab file 4th year ece branch

Uploaded by

Khatugas
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
‘LIST OF EXPERIMENTS S.NO. E OF EXPERIME To illustrate the simple Mathematical Expressions in Matlab. a. X=2S,y=xel Z=Hly. b. r= n(1/3)-1, area=n*r'2 e x= 3*sqrt(5)-1, y= sqrt(5)+1/2,2=Wy-1; Using MATLAB generate + Basic Discrete time signals/waveform * A discrete exponential sequence * A discrete complex exponential sequence. rz) Using MATLAB find the convolution of two linear sequences. T-iz Using MATLAB find out the discrete Fourier Transform (DFT) of rectangular pulse and plot phase and magnitude spectrum. Using MATLAB find out the convolution between two sequences by the help of discrete. fourier ‘ransform(DFT) 114 1516 To design Chebyshev type filter + High Pass Filter © Low Pass Filter 17-19 To design a butterworth filter Band Pass Filter «High Pass Filter ‘+ Low Pass Filter 20-23 To Design a elliptical IIR Filter © High Pass Filter © Low Pass Filter 24-26 To design an equiripple linear Phase FIR filter. DSP LAB EXPERIMENTS 1. Using MATLAB generate a. To generate basic signals/waveform b. A discrete exponential c. A discrete complex exponen! quen al sequence. 1(a)Unit Step n=-20:20; unit=n>=0; stem(n, unit); xlabel(‘Time sample '); ylabel(‘Amplitude’); titleCunit step signal__ your name’); 1(a)Unit Impulse close all; clear all; % creating time stamp for the signal n=-10:1:10; °% Generating Unit impulse sequence impulse = [zeros(1,10),ones(1,1),zeros(1,10)]; % Plotting the unit impulse sequence stem(n, impulse); xlabel(’x_input); ylabel(output’); {itle(’ Unit Impulse Sequence_your name’); axis({-10 10 0 1.2]); 1(a)Unit Ramp ge DSP LAB EXPERIMENTS DSP LAB EXPERIMENTS xlabel(’x_input-——— -your name); 1b) a=input(Enter the real part a="); b=input('Enter the imaginary part b="); k=input(‘constant x=input(variable x="); c=ati*b; yak*oAx; disp(real(y)) stem(x,real(y)) Ys title(real part of sequence’); Ic) a=input('Enter the real part a=); b=input(Enter the imaginary part b=); k=input(‘constant k=); x=input('variable x="); c=ati*b; yak *oAx; disp(imag(y)) stem(x,imag(y)) xlabel('frequencyl'); ylabel(‘amplitude'); title(imaginary part of sequence__ your name’); fee ol? Rragnomm for Sere exponential gen J ae input ( Sentra) ; ee Ke input” (4 enter 1 me DOS Xe aan enter 0) kta. Alem (4, te, ya oni” ae oo real peice aunee) Tad DsP LAB EXPERIMENTS te fourier transform (D 5, Using MATLAB find out the dser rectangular pulse and plot phase and mat Jinput(type the length of A [N= input (‘type the length of the sequence ~ u-ones (1,N) eft (uM) 0:1: figure subplot@,1,1) tite (original time domain sequence" ylabel amplitude’) label (time index n') sibplot (1,2) Ke0:1:M-l tem (K.abs(U itude of df samples label (frequency index K° ylabel (magnitude sudplot(3,1,3) stem(K angle(U)) title (Magnitude of df samples ylabel(phase’) E DSP LAB EXPERIMENTS 4. Using MATLAB find out the convolution between two sequences by the help of discrete fourier transform(DFT) cle; clear all; x=input(Input First Sequence="); h=input(Input Second Sequence="); nl=length(x); n2=length(h); N=nl+n2-1; x1=[x zeros(1,N-n1)]; x2=[h zeros(1,N-n2)]; a=fit(x, N); b=fii(h, N); c=a."b; disp(‘output sequence’); disp(c) d=iff(c, N); dn=0:N-1; subplot(3,1,1); stem(x); title(First Sequence’); ylabel(‘Signal'); xlabel(‘Time'); subplot(3,1,2); stem(h); title('Second Sequence’); ylabel('Signal'); xlabel(‘Time’); subplot(3,1,3); stem(d); title(‘Convolved Sequence _your name'); ylabel('Signal'); pas xlabel('Time'); Mm Sy DSP LAB EXPERIMENTS 5. To design Chebyshev type filter d. High Pass Filter e. Low Pass Filter PROGRAM: HIGH PASS FILTER cle; am=input(‘type in the order of filter=!); ™input(type in the pass band of filte W"input(‘type in the passband of frequency edge (b,a}-cheby1 (am,,w,high’); disp(numerator polynomial’) disp(b) disp(‘denominator polynomial’) disp(a) w=0:0.2/picpi; h=freqz(b,a,w); gain=20*log 0(abs(h)); stem(w/pi,gain); grid xlabel(‘normalised frequency’) ylabel('gain(dB)') title(high pass filter’) LOW PASS FILTER fee DSP -LAB EXPERIMENTS inion te onder offer, "Tamu in the pas ond offer tein th passband of queney edge Bal-eheby as.ytowy: ‘ispeoumeratorpolynomiat) disp(b) «ispCdcnominatorpolynomia) disp(a) w0:0.2pipi; b-tregeoa,w); £8in=20*log O(abs(h)); stem(wip,gain); rid ‘xlabel(normalised frequency’) ylabel(gain(aBy) tileClow pass filter) ‘OBSERVATION; For High Pass Filter >Order of the fiter=2 > Pass band ripple = 0.5 > Pass band ripple frequency = 0.2 For Low Pass Filter: DSP LAB EXPERIMENTS © Order of filter = 2 © Pass band ripple = 0.3 Sas ey © Pass band frequency = 0.9 DSP LAB EXPERIMENTS 6. To design a butterworth filter a) Band Pass Filter b) High Pass Filter ¢) Low Pass Filter BAND PASS FILTER: ‘N=input(enter the filter order='); M=N/2; w1-input(‘lower pass band edge frequency"); w2-input(‘upper pass band edge frequency); w-[wl,w2]; [b.a]-butter(M.w); disp(‘numerator polynomial’); disp(b) disp(denominator polynomial’); disp(a) w-0:0.02/pi-pis n=freqz(b,a,w); gain=20*log] 0(abs(h)); stem(w/pi,gain) grid; xlabel(’Normalized the frequency’) ylabel(‘Gain,db') title(Butterworth Band pass filter) HIGH PASS FILTER: Ne-input(‘enter the filter order—')s M=N2; w=input(‘enter the low edge frequency’); [b,a}=butter(M,w-high’); pe DSP LAB EXPERIMENTS disp(‘numerator polynomial’); disp(b) disp(‘denominator polynomial’); disp(a) w=0:0.02/pi:pi; h=freqz(b,a,w); gain=20*log1 0(abs(h)); stem(w/pi,gain) grid; xlabel(‘Normalized frequency’) ylabel('Gain,db') title('Butterworth High pass filter’) (3) LOW PASS FILTER: N=input(‘enter the filter order); M=N/2; w=input(enter the high frequency"); [b,a]=butter(M,w,'low)); disp(‘aumerator polynomial’); disp(b) disp(‘denominator polynomial’); disp(a) w=0:0.02/pi:pi; h=freqz(b.a,w); gain=20*logl 0(abs(h)); stem(w/pi,gain) grids xlabel(‘Normalized frequency’) ylabel(‘Gain,db’) title(Butterworth low pass filter’) OBSERVATIONS: (1) FOR BAND PASS FILTER: enter the filter order=2 s whe lower pass band edge frequency=0.1 1D, DSP LAB EXPERIMENTS ‘upper pass band edge frequency=0.9 (2) FOR HIGH PASS FILTER: enter the filter order—4 enter the low edge frequency=0.01 (3) FOR LOW PASS FILTER: enter the filter order=4 gy enter the high frequency=0.01 » DSP LAB EXPERIMENTS 7. Te Design a elliptical IIR Filter a. High Pass Filter b. Low Pass Filter ‘N=input(‘Type the order of filter put("Type passband ripple="); S=input('Type min. stopband attenuatior W=input(‘Type the passband edge frequency"); [b,a}=ellip(N,R,S,W, low’); disp(‘numerator polynomial’); disp(b) disp(‘denominator polynomial’); disp(a) w=0:0.2/pi:pi; freqz(b,a,w); gain=20*log] 0(abs(h)); stem(w/pi,gain); grid xlabel(‘normalised frequency’); ylabel(‘gain(db)’); title('Elliptic LPF (your name)’); High Pass Filter Neinput("Type the order of filter="); R=input(Type passband ripple=); S=input(‘Type min. stopband attenuation='); W=input('Type the passband edge frequency="); [b,a]=ellip(N,R,S,W, high’); disp(‘numerator polynomial’); disp(b) disp(‘denominator polynomial’); disp(a) w=0:0.2/pizpi; h=freqz(b,a,w); gain=20*log! 0(abs(h)); stem(w/pi,gain); grid xlabel('normalised frequency’); ylabel('gain(db)’); tile(Elliptic HPF __ your name’); fu DSP LAB EXPERIMENTS 8. To design an equiripple linear Phase FIR filter. nput('Type the filter order='); finput(Type the band edge=); m=input(Type the magnitude value="); b=remez(N, fm); disp(FIR filter coefficients’); disp(b) h,w]=freqz(b, 1,256); mag=20*log10(abs(h)); plot(w/pimag); grid xlabel('normalised frequency’); ylabel(‘gain (db)'); title(Equiripple FIR fil ter _ your name’); aw

You might also like