P. 1
lab manul

lab manul

|Views: 8|Likes:
Published by Garima Taank

More info:

Published by: Garima Taank on Aug 08, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

10/31/2014

pdf

text

original

INVERSE Z TRANSFORM AIM: To develop a program for Computing Inverse Z-Transform EQUIPMENTS: MATLAB 7.

5 THEORY: Description: In mathematics and signal processing, the Z-transform converts a discrete time-domain signal, which is a sequence of real or complex numbers, into a complex frequency-domain representation. The Z-transform, like many other integral transforms, can be defined as either a one-sided or two-sided transform. The bilateral or two-sided Z-transform of a discrete-time signal x[n] is the function X(z) defined as

. Alternatively, in cases where x[n] is defined only for n ≥ 0, the single-sided or unilateral Z-transform is defined as

In signal processing, this definition is used when the signal is causal. Rational Z-transform to partial fraction form: Consider the transfer function in the rational form i-e; 18z3 G(z)= -----------------18z3+3z2-4z-1 We can evaluate the partial fraction form of the above system using matlab command. The partial fraction form be, G(z)= 0.36__ + __0.24__ + _0.4____ 1 – 0.5z-1 1+0.33 z-1 (1+0.33 z-1) Matlab command that converts rational z-transform in to partial fraction form is ‘residuez’. If you want to see the poles and zeros in a zplane. This function displays the poles and zeros of discrete-time systems. Use the under given matlab command zplane(b,a) PROGRAM CODE:
%program to perform Inverse Z-Transform b=[1,0.4*sqrt(2)]; a=[1,-0.8*sqrt(2),0.64]; [R,P,C]=residuez(b,a); m=abs(P'); subplot(1,2,1); plot(m); title('magnitude'); A=angle(P')/pi; subplot(1,2,2); plot(A); title('Angle'); freqz(a,b,10)

Column vector contains P contains the pole locations. 5. 3.ALGORITHM: 1. Plot the pole magnitudes. Plot the pole angles in pi units. Returned vector R contains the residues. And row vector contains the direct terms. Input Sequence: RESULT: MAGNITUDE AND ANGLE:- . Plot the frequency response of given z-transform of the given function. Write the poles and zeros of the input sequence. 4. 2.

15 -0.7 0.1 0.9 1 magnitude 2 1.2 -0.2 0.1 1 0.5 2 -0.4 0.05 -0.4 0.5 0.2 0.9 1 150 Phase (degrees) 100 50 0 0 0.05 0 0.1 0.25 0.2 0.5 1 1.3 0.6 0.6 0.15 0.5 2 .3 0.7 0.5 0.20 Magnitude (dB) 10 0 -10 -20 0 0.5 0.1 0 -0.8 Normalized Frequency ( rad/sample) Angle 0.8 Normalized Frequency ( rad/sample) 0.5 -0.25 1 1.

rs=input('enter the stopband ripple'). . ws=2*fs/f. Order of the filter should be specified. placing a window of finite length does this. f=input('enter sampling freq '). end y c=input('enter your choice of window function 1. rp=input('enter passband ripple'). rectangular 2. These coefficients are generated by using FDS (Filter Design Software or Digital filter design package). num=-20*log10(sqrt(rp*rs))-13. In this equation. Hamming. if(rem(n. n1=n+1. PROGRAM: %fir filt design window techniques clc. dem=14. An FIR transversal filter structure can be obtained directly from the equation for discrete-time convolution. EQUIPMENTS: Constructor – MATLAB Software THEORY: A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system whose output is based on the weighted summation of a finite number of past inputs. fp=input('enter passband freq'). Hanning. Barlett.2)~=0) n1=n. triangular 3. disp('Rectangular window filter response'). clear all. Infinite response is truncated to get finite impulse response. wp=2*fp/f.6*(fs-fp)/f. n=n-1. FIR – filter is a finite impulse response filter. h(n-k) is the transversal filter coefficients at time n. fs=input('enter stopband freq'). Blackmann window etc. x(k) and y(n) represent the input to and output from the filter at time n. Types of windows available are Rectangular.kaiser: \n ').FIR filters AIM: To verify FIR filters. This FIR filter is an all zero filter. n=ceil(num/dem). close all. if(c==1) y=rectwin(n1).

%BSF b=fir1(n.256).o]=freqz(b. m=20*log10(abs(h)). disp('Triangular window filter response'). subplot(2.plot(o/pi. xlabel('(b) Normalized frequency-->').1. b=fir1(n.256).end if (c==2) y=triang(n1). m=20*log10(abs(h)). xlabel('(c) Normalized frequency-->').2.'high'.wp.2.1. %HPF b=fir1(n. title('LPF'). end if(c==3) y=kaiser(n1).1). ylabel('Gain in dB-->'). %BPF wn=[wp ws].3). ylabel('Gain in dB-->').2. subplot(2. m=20*log10(abs(h)). [h. ylabel('Gain in dB-->').4).wp.1.1.m). xlabel('(d) Normalized frequency-->') RESULTS: . [h. xlabel('(a) Normalized frequency-->'). m=20*log10(abs(h)).wn. disp('kaiser window filter response'). subplot(2.m).2). title('BSF').'stop'.y).2.y). subplot(2.m).256).plot(o/pi.plot(o/pi.m). title('BPF'). title('HPF').y).wn. [h.o]=freqz(b.o]=freqz(b. ylabel('Gain in dB-->').plot(o/pi. end %LPF b=fir1(n. [h.y).o]=freqz(b.256).

.

PROGRAM: % IIR filters LPF & HPF clc.'low'.a. [b. [h.wn. These filter coefficients are generated using FDS (Filter Design software or Digital Filter design package).MATLAB THEORY: The IIR filter can realize both the poles and zeroes of a system because it has a rational transfer function. HPF \n ').a]=butter(n. end w=0:.rs.wn. [b. LPF 2.'s').close all. fs=input('enter the sampling freq').rp. w1=2*wp/fs.01:pi. disp('enter the IIR filter design specifications'). bk and ak are the filter coefficients. described by polynomials in z in both the numerator and the denominator: The difference equation for such a system is described by the following: M and N are order of the two polynomials. EQUIPMENTS: Software . ws=input('enter the stopband freq').a]=butter(n. wp=input('enter the passband freq'). if(c==1) disp('Frequency response of IIR LPF is:'). IIR filters can be expanded as infinite impulse response filters.'s').IIR filters AIM: To design and implement IIR (LPF/HPF)filters.'high'.wn]=buttord(w1. Filter coefficients can be found and the response can be plotted. c=input('enter choice of filter 1. . [n. That’s why the filters are named as butter worth filters.w2.clear all.'s'). cutoff frequencies of the filters should be mentioned. In designing IIR filters. rs=input('enter the stopband ripple'). rp=input('enter the passband ripple'). The order of the filter can be estimated using butter worth polynomial. end if(c==2) disp('Frequency response of IIR HPF is:').w2=2*ws/fs.w).om]=freqs(b.

ylabel('Phase in radians-->').1.1). -->'). an=angle(h). figure. subplot(2.m). xlabel('(b) Normalized freq. RESULTS: .plot(om/pi.m=20*log10(abs(h)).1. -->'). ylabel('Gain in dB-->'). title('phase response of IIR filter is:').plot(om/pi.an). title('magnitude response of IIR filter is:'). xlabel('(a) Normalized freq.subplot(2.2).

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->