Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Microphone Distortion Compensation using MATLAB: Designing a Linear System, Assignments of Signals and Systems

A solution to homework #8 in ee422g, where students are asked to design a linear system to compensate for distortion caused by a microphone using matlab. The transfer functions of the microphone and instructions to create a compensating filter. It also discusses the importance of checking if the microphone is a minimum phase system before applying the inverse filter.

Typology: Assignments

Pre 2010

Uploaded on 10/01/2009

koofers-user-om2-1
koofers-user-om2-1 🇺🇸

10 documents

1 / 8

Toggle sidebar

Related documents


Partial preview of the text

Download Microphone Distortion Compensation using MATLAB: Designing a Linear System and more Assignments Signals and Systems in PDF only on Docsity! EE422G Solution to Homework #8 1. MATLAB >> H1 = tf([1 3 4],[1 6 11 6]); >> H2 = tf([1 2 3 2],[1 -10 35 50 24]); >> step(H1) 0 1 2 3 4 5 6 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 Step Response Time (sec) A m pl itu de >> step(H2) 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0 0.5 1 1.5 2 2.5 3 3.5 Step Response Time (sec) A m pl itu d e >> pzmap(H1) -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 -1.5 -1 -0.5 0 0.5 1 1.5 Pole-Zero Map Real Axis Im ag in ar y A xi s All LHP poles ⇒ H1 is BIBO stable >> pzmap(H2) -2 -1 0 1 2 3 4 5 6 -5 -4 -3 -2 -1 0 1 2 3 4 5 Pole-Zero Map Real Axis Im ag in ar y A xi s Two RHP poles ⇒ H2 is unstable >> bode(H1) -40 -30 -20 -10 0 M ag ni tu de ( dB ) 10 -2 10 -1 10 0 10 1 10 2 -90 -45 0 P ha se ( de g) Bode Diagram Frequency (rad/sec) Even you can use MATLAB to show the Bode plot of H2, it does not exist because H2 has two RHP poles. Thus, we should not blindly trust the results of MATLAB. >> t=0.01:0.01:10; >> pzmap(H1) -800 -700 -600 -500 -400 -300 -200 -100 0 -1.5 -1 -0.5 0 0.5 1 1.5 x 10 4 Pole-Zero Map Real Axis Im ag in ar y A xi s Indeed, all the zeros and poles are on the open left half plane (the jw-axis is the right boundary of the figure.) As a result, you can apply G(s) = 1/H(s) to the sound and you should get a much clearer voice: >> [numH1, denH1] = tfdata(H1,'v'); >> G1 = tf(denH1, numH1) Transfer function: s^2 + 1520 s + 2.92e006 ----------------------- 0.04 s^2 + 8 s + 4e006 >> s1 = wavread('distortedSound.wav'); >> tsteps = 1/44100*(0:1:(length(s1)-1)); % sampled @ 44.1kHz >> y1 = lsim(G1,s1,tsteps); >> sound(y1,44100) For part b), once again let’s consider whether the microphone transfer function is a minimum phase system: >> H2 = tf(0.03*[1 -2e2 1.0001e8],[1 1.52e3 2.92e6]) Transfer function: 0.03 s^2 - 6 s + 3e006 ----------------------- s^2 + 1520 s + 2.92e006 >> pzmap(H2) -800 -700 -600 -500 -400 -300 -200 -100 0 100 200 -1.5 -1 -0.5 0 0.5 1 1.5 x 10 4 Pole-Zero Map Real Axis Im ag in ar y A xi s The zeros are on the right half plane and thus it is not a minimum phase system – the inverse system G(z) = 1/H(z) will have poles on the right half plane and become unstable. If you simulate G(z) and plot the output, you will get something like this. >> [numH2, denH2] = tfdata(H2,'v'); >> G2 = tf(denH2, numH2); >> s2 = wavread('distortedSound2.wav'); >> y2 = lsim(G2,s2,tsteps); >> plot(tsteps,y2) 0 2 4 6 8 10 12 -1.7405 0.0224 1.7853 x 10 308 O ut pu t of G 2 I hope dearly that you didn’t play this to your speaker! On the other hand, we can build an approximate inverse system by using positive feedback system. )(1 )( 2 2 sAH A sG + = for a constant A such that |AH2(jω)|>>1 is large enough within the operating range. Expanding G2(s) analytically, we have 332 62 2 10)003.392.2()61052.1()03.01( 100003.3603.0 )( ×++−×++ ×+−= AsAsA AAsAs sG By using Routh Array, you can easily show that G2(s) does not have any RHP poles if -0.97<A<253.3. As we want A to be big, let’s try A = 250. First we want to check |AH2(jω)|: >> A = 250; trial = tf(A*numH2,denH2); >> bode(trial) -50 0 50 100 M ag ni tu de ( dB ) 10 2 10 3 10 4 10 5 0 180 360 P ha se ( de g) Bode Diagram Frequency (rad/sec) Note that the |AH2(jω)| drops below 1 (0 dB) around 10 4 rad/second (or 1600 Hz). Human speech can contain frequency component up to 16000 Hz, thus we would expect that our inverse filter can help only in the low-frequency range. >> G2 = tf(A*denH2,A*numH2+denH2); >> y2 = lsim(G2,s2,tsteps); >> sound(y2,44100) How are you getting the desired results? 3. (4 points) We have seen the aliasing effect visually during lecture. In this problem, you are asked to explore the aliasing effect in audio. Download the MATLAB script aliasing_demo_audible.m from the homework webpage and run it. You will hear six tones at different frequencies: 500Hz, 2kHz, 3kHz, 4.5kHz, 5.5kHz and 7kHz. All the signals are sampled at 5kHz. Explain what you hear using the Nyquist Theorem. Aliasing occurs in the last four tones resulting in distortion on the pitch.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved