Anda di halaman 1dari 7

DSP MATLAB ASSIGNMENT

Submitted to:
Prof. Arulmoziharan.P

By:
Name: Himanshu Arora Reg.no:10BEC0426

Q.1 Suppose the x(n) is a geometric sequencen x(n)=((0.7)^n) * u(n), h(n) = impulse(n) + 0.9 impulse(n-no) where no=10. Remove the echo in y(n)=x(n)*h(n) as completely possible using cepstral deconvolution and dft size N=128.

Algorithm : Step 1: Step 2: Step 3: Step 3 : present Generate two signals x(n) and h(n). Convolute the signals x(n) and h(n) using in-built function conv. Find the 128 point DFT of the signal through fft approach Convert the signal into cepstral domain to observe the peak of echo

in the signal . Step 4: Pass the signal through butterworth filter to eliminate the echo. Step 5 : convert back the signal from cepstral to time domain and then compare with original message signal.

MATLAB CODE
clc; clear all; close all; n=0:127; N=length(n); x=((0.7).^n).*(ones(1,N)); h1=[1 zeros(1,N-1)]; h2=[zeros(1,9) 1 zeros(1,N-10)]; h=h1+0.9*h2; y=conv(x,h); k=0:1:(length(y)-1); subplot(2,2,1); plot(n,x); title('Message Signal'); subplot(2,2,2); plot(k,y); title('Message Signal After Convolution'); x1=fft(y,128); subplot(2,2,3);

stem(x1); title('FFT of convoluted signal'); z=cceps(y); [h1 w1]=freqz(z); subplot(2,2,4); plot(z); title('Cepstral Ananlysis'); q1=log(x1); q2=fft(q1); [a,b]=butter(2,0.04,'low'); b=filter(a,b,q2); p=ifft(b); p1=exp(p); m=ifft(p1); figure(3); plot(n,x); hold on; plot(abs(m),'r'); title(' Comparing the signal obtained after removal of echo with orignal messege signal');

OUTPUT WAVEFORMS

INFERENCE 1. Cepstral analysis can be used to observe the peak of echo present in the signal. 2. Cepstral analysis can be applied only on the real data. 3. Cepstral analysis returns the complex cepstrum of the real data sequence x using the Fourier transform. 4. The second order butterworth filter is used to remove the echo present in the signal.

Q2.

Acquire a 512 point discrete time signal (ex-a sample of speech). First plot the entire sequence and entire DFT magnitude spectrum .Now, we wish to show the spectrum centered on fc=0.4 wth fc +f as 0.42 and fc-f=0.38. Using, MATLAB-FIR1 filter (Hamming window) design BPF h(n) [f(r)] that posses only this range of frequencies.

ALGORITHM Step 1 : To generate the signal , record the audio speech from speaker.

Step 2: Generate a 512 DFT of the sequence using fft and plot it. Step 3: Obtain the magnitude spectrum of above DFT and plot it. Step 4: Design a FIR bandpass filter of the given frequencies which uses hamming window. Step 5 : Filter the fft of the signal and observe the response which will only posses signal in bandpass frequencies range.

MATLAB CODE
clc; clear all; close all; % generation of the signal recObj = audiorecorder; disp('Start speaking.') recordblocking(recObj, 2); disp('End of Recording.'); x = getaudiodata(recObj); figure(1); plot(x); title(' speech signal'); % 512 point DFT figure(2); N=512; f=(0:N-1)/N; h=fft(x,N); subplot(2,1,1); stem(f,h); title(' 512 point DFT of the signal'); % Magitude spectrum of 512 point DFT subplot(2,1,2); plot(f,abs(h)); title('magnitude spectrum of the DFT'); % Band pass filter design using FIR figure(3); b=fir1(38,[0.38 0.42]); [h w]=freqz(b,1,512); subplot(2,1,1); plot(f,abs(h)); title('bandpass filter design'); %Filtering the fft signal obtained c=filter(b,1,h)

subplot(2,1,2); stem(f,c); title(' output fft signal consisting of only bandpass frequencies');

OUTPUT WAVEFORMS

INFERENCE

1. FIR filter can be used to obtain H.P, L.P ,B.P and B.S filters. 2. FIR filters uses inbuilt hamming window whch is used to remove discontinuities at the edges. 3. It uses a hamming window of N+1 length sequence if N is the order of FIR filter. 4. The output FFT posses signal at only bandpass frequencies.

Anda mungkin juga menyukai