<< Chapter < Page Chapter >> Page >

That funny phase

You probably noticed in the last problem that even though the wave forms looked fairly different, the sound was similar. Let's look into this a bit deeper with a simpler sound.

  • Create a script file called phasefun.m to put your code in for this problem.
  • Pick two harmonic frequencies and generate a signal from two cosines at these frequencies added together and call it sig1 . Use Fs = 8000 (remember that you can reproduce only frequencies that are less than Fs/2 ).
  • Now generate a second signal called sig2 exactly the same as the first one, except time delay the second cosine by a half cycle (half of its period).
  • Use subplot to show a few periods of both signals, do they look different? Save the plot as phasesigs.tif . What did the time delay do to the phase?
  • Play each signal with soundsc , do they sound different?
  • Redo sig2 with a few different delays and compare the sound to the first signal.
  • Create a sig3 that is one cosine at some frequency. Now add sig3 with a timed delayed version of itself and call it sig4 . Use a quarter cycle delay.
  • Use subplot and plot a few periods of sig3 and sig4 . Play them with soundsc , do they sound different to you?
  • What is suggested about our hearing capabilities from this experiment?
  • You will need to show the TA the following files: phasefun.m phasesigs.tif

Truncated fourier series

In this section, we'll reconstruct the periodic function x(t) , shown in Figure 1, by synthesizing a periodic signal from a variable number of Fourier Series coefficients, and observe similarities and differences in the synthesized signal.

Periodic Signal

Gibbs phenomena

  • Create a script file called gibbs.m to put your code in for this problem.
  • Click here to download the MATLAB function Ck.m . Take a look at the contents of the function. This function takes one argument k , and creates the k th Fourier series coefficient for the squarewave above:
    C k = { 0 if  k = 0 ,   k  even 1 j k π [ cos ( 2 k π 3 ) cos ( k π 3 ) ] if  k  odd MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVCI8FfYJH8YrFfeuY=Hhbbf9v8qqaqFr0xc9pk0xbba9q8WqFfeaY=biLkVcLq=JHqpepeea0=as0Fb9pgeaYRXxe9vr0=vr0=vqpWqaaeaabiGaciaacaqabeaadaqaaqaaaOqaaiaadoeadaWgaaWcbaGaam4AaaqabaGccqGH9aqpdaGabaqaauaabaqaciaaaeaacaaIWaaabaGaaeyAaiaabAgacaqGGaGaam4Aaiabg2da9iaaicdacaGGSaGaaeiiaiaadUgacaqGGaGaaeyzaiaabAhacaqGLbGaaeOBaaqaamaalaaabaGaaGymaaqaaiaadQgacaWGRbGaeqiWdahaamaadmaabaGaci4yaiaac+gacaGGZbWaaeWaaeaadaWcaaqaaiaaikdacaWGRbGaeqiWdahabaGaaG4maaaaaiaawIcacaGLPaaacqGHsislciGGJbGaai4BaiaacohadaqadaqaamaalaaabaGaam4Aaiabec8aWbqaaiaaiodaaaaacaGLOaGaayzkaaaacaGLBbGaayzxaaaabaGaaeyAaiaabAgacaqGGaGaam4AaiaabccacaqGVbGaaeizaiaabsgaaaaacaGL7baaaaa@64FA@
    C k ( 1 ) = 1 j π = 0 + j 0.3183 MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVCI8FfYJH8YrFfeuY=Hhbbf9v8qqaqFr0xc9pk0xbba9q8WqFfeaY=biLkVcLq=JHqpepeea0=as0Fb9pgeaYRXxe9vr0=vr0=vqpWqaaeaabiGaciaacaqabeaadaqaaqaaaOqaaiaadoeadaWgaaWcbaGaam4AaaqabaGccaGGOaGaaGymaiaacMcacqGH9aqpdaWcbaWcbaGaeyOeI0IaaGymaaqaaiaadQgacqaHapaCaaGccqGH9aqpcaaIWaGaey4kaSIaamOAaiaaicdacaGGUaGaaG4maiaaigdacaaI4aGaaG4maaaa@4758@ . Plot the magnitude and phase of thecoefficients C k for k { 10 , 9 , , 9 , 10 } MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVCI8FfYJH8YrFfeuY=Hhbbf9v8qqaqFr0xc9pk0xbba9q8WqFfeaY=biLkVcLq=JHqpepeea0=as0Fb9pgeaYRXxe9vr0=vr0=vqpWqaaeaabiGaciaacaqabeaadaqaaqaaaOqaaiaadUgacqGHiiIZdaGadaqaaiabgkHiTiaaigdacaaIWaGaaiilaiabgkHiTiaaiMdacaGGSaGaeSOjGSKaaiilaiaaiMdacaGGSaGaaGymaiaaicdaaiaawUhacaGL9baaaaa@44B3@ . The magnitude and phase should be plotted separately using the subplot command, with the magnitude plotted in the top half of the window and the phase in the bottom half. Place frequency w on the x axis. Use the MATLAB command stem instead of plot to emphasize that the coefficients are a function of integer-valued (not continuous) k . Label your plots.
  • Save the graph as Coeff.tif .
  • Write whatever script/function files you need to implement the calculation of the signal x t with a truncated Fourier series:
    x t k K max K max C k e jk ω 0 t k 0 K max 2 C k cos k ω 0 t C k
    for a given K max
    You can avoid numerical problems and ensure a real answer if you use the cosine form. For this example, w 0 = 1 MathType@MTEF@5@5@+=feaafiart1ev1aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLnhiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr4rNCHbGeaGqiVCI8FfYJH8YrFfeuY=Hhbbf9v8qqaqFr0xc9pk0xbba9q8WqFfeaY=biLkVcLq=JHqpepeea0=as0Fb9pgeaYRXxe9vr0=vr0=vqpWqaaeaabiGaciaacaqabeaadaqaaqaaaOqaaiaadEhadaWgaaWcbaGaaGimaaqabaGccqGH9aqpcaaIXaaaaa@398F@ .
  • Produce plots of x t for t 5 5 for each of the following cases: K max = 5; 15; and 30. For all the plots, use as your time values the MATLAB vector t=-5:.01:5 . Stack the three plots in a single figure using the subplot command and include your name in the title of the figure. Save the figure as FourTrunc.tif
  • Add clear comments describing what the files do. You will need to show the TA the following files: gibbs.m Coeff.tifFourTrunc.tif

As you add more cosines you'll note that you do get closer to the square wave (in terms of squared error), but that at the edges there is some undershoot and overshoot that becomes shorter in time, but the magnitude of the undershoot and overshoot stay large. This persistent undershoot and overshoot at edges is called Gibbs Phenomenon.

In general, this kind of "ringing" occurs at discontinuities if you try to synthesize a sharp edge out of too few low frequencies. Or, if you start with a real signal and filter out its higher frequencies, it is "as if" you had synthesized the signal from low frequencies. Thus, low-pass filtering (a filter that only passes low-frequencies) will also cause this kind of ringing.

For example, when compressing an audio signal, higher frequencies are usually removed (that is, the audio signal is low-pass filtered). Then, if there is an impulse edge or "attack" in the music, ringing will occur. However, the ringing (called "pre-echo" in audio) can be heard only before the attack, because the attack masks the ringing that comes after it (this masking effect happens in your head). High-quality MP3 systems put a lot of effort into detecting attacks and processing the signals to avoid pre-echo.

What to show the ta

Show the TA ALL m-files that you created or edited and the files below. gibbs.m Coeff.tifFourTrunc.tif sigsynth.maddcosines.m synthwaves.tifphasefun.m phasesigs.tifany wav files created

An applet here provides a great interface for listening to sinusoids and their harmonics. There are some well-known auditory illusions associated with the perception of pitch here .

Questions & Answers

differentiate between demand and supply giving examples
Lambiv Reply
differentiated between demand and supply using examples
Lambiv
what is labour ?
Lambiv
how will I do?
Venny Reply
how is the graph works?I don't fully understand
Rezat Reply
information
Eliyee
devaluation
Eliyee
t
WARKISA
hi guys good evening to all
Lambiv
multiple choice question
Aster Reply
appreciation
Eliyee
explain perfect market
Lindiwe Reply
In economics, a perfect market refers to a theoretical construct where all participants have perfect information, goods are homogenous, there are no barriers to entry or exit, and prices are determined solely by supply and demand. It's an idealized model used for analysis,
Ezea
What is ceteris paribus?
Shukri Reply
other things being equal
AI-Robot
When MP₁ becomes negative, TP start to decline. Extuples Suppose that the short-run production function of certain cut-flower firm is given by: Q=4KL-0.6K2 - 0.112 • Where is quantity of cut flower produced, I is labour input and K is fixed capital input (K-5). Determine the average product of lab
Kelo
Extuples Suppose that the short-run production function of certain cut-flower firm is given by: Q=4KL-0.6K2 - 0.112 • Where is quantity of cut flower produced, I is labour input and K is fixed capital input (K-5). Determine the average product of labour (APL) and marginal product of labour (MPL)
Kelo
yes,thank you
Shukri
Can I ask you other question?
Shukri
what is monopoly mean?
Habtamu Reply
What is different between quantity demand and demand?
Shukri Reply
Quantity demanded refers to the specific amount of a good or service that consumers are willing and able to purchase at a give price and within a specific time period. Demand, on the other hand, is a broader concept that encompasses the entire relationship between price and quantity demanded
Ezea
ok
Shukri
how do you save a country economic situation when it's falling apart
Lilia Reply
what is the difference between economic growth and development
Fiker Reply
Economic growth as an increase in the production and consumption of goods and services within an economy.but Economic development as a broader concept that encompasses not only economic growth but also social & human well being.
Shukri
production function means
Jabir
What do you think is more important to focus on when considering inequality ?
Abdisa Reply
any question about economics?
Awais Reply
sir...I just want to ask one question... Define the term contract curve? if you are free please help me to find this answer 🙏
Asui
it is a curve that we get after connecting the pareto optimal combinations of two consumers after their mutually beneficial trade offs
Awais
thank you so much 👍 sir
Asui
In economics, the contract curve refers to the set of points in an Edgeworth box diagram where both parties involved in a trade cannot be made better off without making one of them worse off. It represents the Pareto efficient allocations of goods between two individuals or entities, where neither p
Cornelius
In economics, the contract curve refers to the set of points in an Edgeworth box diagram where both parties involved in a trade cannot be made better off without making one of them worse off. It represents the Pareto efficient allocations of goods between two individuals or entities,
Cornelius
Suppose a consumer consuming two commodities X and Y has The following utility function u=X0.4 Y0.6. If the price of the X and Y are 2 and 3 respectively and income Constraint is birr 50. A,Calculate quantities of x and y which maximize utility. B,Calculate value of Lagrange multiplier. C,Calculate quantities of X and Y consumed with a given price. D,alculate optimum level of output .
Feyisa Reply
Answer
Feyisa
c
Jabir
the market for lemon has 10 potential consumers, each having an individual demand curve p=101-10Qi, where p is price in dollar's per cup and Qi is the number of cups demanded per week by the i th consumer.Find the market demand curve using algebra. Draw an individual demand curve and the market dema
Gsbwnw Reply
suppose the production function is given by ( L, K)=L¼K¾.assuming capital is fixed find APL and MPL. consider the following short run production function:Q=6L²-0.4L³ a) find the value of L that maximizes output b)find the value of L that maximizes marginal product
Abdureman
types of unemployment
Yomi Reply
What is the difference between perfect competition and monopolistic competition?
Mohammed
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Continuous time linear systems laboratory (ee 235). OpenStax CNX. Sep 28, 2007 Download for free at http://cnx.org/content/col10374/1.8
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Continuous time linear systems laboratory (ee 235)' conversation and receive update notifications?

Ask