Hi, I've just started to read Richard G. Lyons 'Understanding Digital Signal Processing, Third Edition' on Safari Books, since I'd like to build an Android app that involves some audio processing. I'm completely new to DSP (and Android development too - so good luck to me). I enjoy the book but the exercises are intended for class work, not self-study, so I'd like to check with you whether I understood. Hope that's ok, if there's a newbie forum, please let me know. Question 23 (Chapter 1): Thinking about the spectra of signals, the ideal continuous (analog) squarewave s(t) in Figure P1�23, whose fundamental frequency is fo Hz, is equal to the sum of an fo Hz sinewave and all sinewaves whose frequencies are odd multiples of fo Hz. We call s(t) �ideal� because we assume the amplitude transitions from plus and minus A occur instantaneously (zero seconds!). Continuous Fourier analysis of the s(t) squarewave allows us to describe this sum of frequencies as the following infinite sum: s(t) = 4A/pi * (sin(2pi*fo*t) + sin(6pi*fo*t)/3 + sin(10pi*fo*t)/5 + ...) Figure P1�23. (my poor attempt to draw it in ascii below, but I'm sure you know what it looks like) ^ |___ ___ | -------------> | ___ | Using a summation symbol, we can express squarewave s(t) algebraically as s(t) = 4A/pi * SUM(sin(2pi*fo*t*n)); where n=1, 3, 5, ... for n = odd integers only, showing s(t) to be an infinite sum of sinusoids. PART a) Imagine applying s(t) to a filter that completely removes s(t)�s lowest-frequency spectral component. Draw the time-domain waveform at the output of such a filter.>>> Ok, so s(t) is an LTI system, correct (it looks like it fulfills the 'homogeneity' and 'shift' constraint of LTIs). To solve this question graphically I simply substract the lowest (that is the fundamental) frequency sine wave. It looks a bit like this:|\/ -------> | /\ Is that correct? b) Assume s(t) represents a voltage whose fo fundamental frequency is 1 Hz, and we wish to amplify that voltage to peak amplitudes of �2A. Over what frequency range must an amplifier operate (that is, what must be the amplifier�s passband width) in order to exactly double the ideal 1 Hz squarewave�s peak-peak amplitude?>>> Hm, the books hasn't gone into amplifiers yet but from the problem statement that s(t) consists of an 'infinite sum' and since it's asking to double the *ideal* squarewave *exactly* I assume the passband width would have to be from 1Hz to infinitiy. Is that correct?I'd appreciate your feedback. Thanks, HC
Novice question - ideal continuous squarewave
Started by ●May 18, 2011
Reply by ●May 18, 20112011-05-18
On 05/18/2011 08:57 AM, hcvst wrote:> Hi, > > I've just started to read Richard G. Lyons 'Understanding Digital Signal Processing,Third Edition' on Safari Books, since I'd like to build an Android app that involves some audio processing. I'm completely new to DSP (and Android development too - so good luck to me).> > I enjoy the book but the exercises are intended for class work, not self-study, soI'd like to check with you whether I understood. Hope that's ok, if there's a newbie forum, please let me know.> > Question 23 (Chapter 1): > Thinking about the spectra of signals, the ideal continuous (analog) squarewave s(t)in Figure P1�23, whose fundamental frequency is fo Hz, is equal to the sum of an fo Hz sinewave and all sinewaves whose frequencies are odd multiples of fo Hz. We call s(t) �ideal� because we assume the amplitude transitions from plus and minus A occur instantaneously (zero seconds!). Continuous Fourier analysis of the s(t) squarewave allows us to describe this sum of frequencies as the following infinite sum:> > s(t) = 4A/pi * (sin(2pi*fo*t) + sin(6pi*fo*t)/3 + sin(10pi*fo*t)/5 + ...) > > Figure P1�23. > (my poor attempt to draw it in ascii below, but I'm sure you know what it looks like) > > ^ > |___ ___ > | > -------------> > | ___ > | > > > Using a summation symbol, we can express squarewave s(t) algebraically as > > s(t) = 4A/pi * SUM(sin(2pi*fo*t*n)); where n=1, 3, 5, ... > > for n = odd integers only, showing s(t) to be an infinite sum of sinusoids. > > PART a) > Imagine applying s(t) to a filter that completely removes s(t)�s lowest-frequencyspectral component. Draw the time-domain waveform at the output of such a filter.> >>>> Ok, so s(t) is an LTI system, correct (it looks like it fulfills the 'homogeneity' and 'shift' constraint of LTIs). To solve this questiongraphically I simply substract the lowest (that is the fundamental) frequency sine wave. It looks a bit like this:> > |\/ > -------> > | /\ > > Is that correct?s(t) is _not_ an LTI system. In fact, s(t) isn't a system at all -- it's a signal. Signal's cannot carry the properties of 'linear' and 'time variance' -- they just are. The waveform is roughly correct. You really need to plot this out with Scilab or some other math package that'll do graphs, to see how much the sine wave distorts the square.> b) > Assume s(t) represents a voltage whose fo fundamental frequency is 1 Hz, and we wishto amplify that voltage to peak amplitudes of �2A. Over what frequency range must an amplifier operate (that is, what must be the amplifier�s passband width) in order to exactly double the ideal 1 Hz squarewave�s peak-peak amplitude?> >>>> Hm, the books hasn't gone into amplifiers yet but from the problem statement thats(t) consists of an 'infinite sum' and since it's asking to double the *ideal* squarewave *exactly* I assume the passband width would have to be from 1Hz to infinitiy. Is that correct?> > I'd appreciate your feedback. Thanks, > HCWell... An amplifier can be thought of as a linear system that is ideally just a multiplication, but which implements a filter of some sort (usually lowpass, or bandpass). So you were pretty close. I'm not sure what Rick was thinking -- you can pretty much name a transfer function of the form H(s) = K * Hu(s), and unless Hu(s) has zeros at all the frequency components of the square wave, I can find a K that'll give you whatever peak-peak amplitude you wish to specify. So it's a trick question. The _real_ question is whether it's there to trick you, or Rich. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●May 19, 20112011-05-19
Hi Tim, thanks so much for your reply. Yes, it makes sense that s[t] is just a signal - I understand now - but couldn't the forumla above s[t]=... be considered a system - one, with LTI properties? With respect to the last question b). "...Over what frequency range must an amplifier operate (that is, what must be the amplifier�s passband width) in order to exactly double the ideal 1 Hz squarewave�s peak-peak amplitude?" - I didn't quite understand your answer. What would be the frequency range to double the amplitude __exactly__? Is it 1Hz to infinity (theoretically)? I'm going to check out one of the plotting packages you mentioned. At the moment I'm using Python to get a feel for the numbers but graphics would certainly help. Thanks for the suggestion. Just started Chapter 2 on 'lowpass' and 'bandpass', so it should make more sense to me soon - I hope. Thanks again, Tim. HC
Reply by ●May 19, 20112011-05-19
On 05/19/2011 08:47 AM, hcvst wrote:> Hi Tim, > > thanks so much for your reply. > > Yes, it makes sense that s[t] is just a signal - I understand now - but couldn't the forumla above s[t]=... be considered a system - one, with LTI properties?s(t) could be considered to _specify_ a system, yes. It'd be an odd one.> > With respect to the last question b). "...Over what frequency range must an amplifier operate (that is, what must be the amplifier�s passband width) in order to exactly double the ideal 1 Hz squarewave�s peak-peak amplitude?" - I didn't quite understand your answer. What would be the frequency range to double the amplitude __exactly__? Is it 1Hz to infinity (theoretically)?As an example, take a filter that presents a 'brick wall' at 2Hz. Put that square wave into it, and you'll get a sine wave at 1Hz out. If the filter has unity DC gain, then you'll see some overshoot (I can't remember -- 9%?). So, just measure or calculate the peak-peak excursion, and adjust the filter gain as necessary.> > I'm going to check out one of the plotting packages you mentioned. At the moment I'm using Python to get a feel for the numbers but graphics would certainly help. Thanks for the suggestion. Just started Chapter 2 on 'lowpass' and 'bandpass', so it should make more sense to me soon - I hope.I'm not sure that Python doesn't have graphics capabilities. I use Scilab, which (ahem) lacks user friendliness, but once you get used to it it's great.> > Thanks again, Tim. > > HC >-- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●May 19, 20112011-05-19
On 05/19/2011 08:47 AM, hcvst wrote:> Hi Tim, > > thanks so much for your reply. > > Yes, it makes sense that s[t] is just a signal - I understand now - but couldn't the forumla above s[t]=... be considered a system - one, with LTI properties? > > With respect to the last question b). "...Over what frequency range must an amplifier operate (that is, what must be the amplifier�s passband width) in order to exactly double the ideal 1 Hz squarewave�s peak-peak amplitude?" - I didn't quite understand your answer. What would be the frequency range to double the amplitude __exactly__? Is it 1Hz to infinity (theoretically)? > > I'm going to check out one of the plotting packages you mentioned. At the moment I'm using Python to get a feel for the numbers but graphics would certainly help. Thanks for the suggestion. Just started Chapter 2 on 'lowpass' and 'bandpass', so it should make more sense to me soon - I hope. > > Thanks again, Tim. > > HC >A note: You're using Google Groups with the 'new' interface. Said interface has two problems for most other USENET users: First, it doesn't apply line wrapping, so on some newsreaders you have these looong lines to contend with. Second, it messes up the headers somehow so that your replies do not end up being threaded correctly. Some slack will be given, 'cause you're a newbie. But if you could use the Google Groups 'old' interface it'd make life easier for the rest of us. (I think you can post to this group via dsprelated.com, too -- and the formatting is much better). -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html
Reply by ●May 19, 20112011-05-19
> > As an example, take a filter that presents a 'brick wall' at 2Hz. �Put > that square wave into it, and you'll get a sine wave at 1Hz out. �If the > filter has unity DC gain, then you'll see some overshoot (I can't > remember -- 9%?). �So, just measure or calculate the peak-peak > excursion, and adjust the filter gain as necessary. >Tim, you remember well. For the OP, the overshoot is 1/2 + G/pi where G is the Gibbs-Wilbraham constant G is the integral of the sync from 0 to pi. G =approx 1.8519370519... so the overshoot = aprox 1.0894898722... So google Gibbs' phenomenom and you will learn some more that will help you with what Rick put in his book. IHTH, Clay
Reply by ●May 19, 20112011-05-19
On May 19, 2:48�pm, Clay <c...@claysturner.com> wrote:> > As an example, take a filter that presents a 'brick wall' at 2Hz. �Put > > that square wave into it, and you'll get a sine wave at 1Hz out. �If the > > filter has unity DC gain, then you'll see some overshoot (I can't > > remember -- 9%?). �So, just measure or calculate the peak-peak > > excursion, and adjust the filter gain as necessary. > > Tim, you remember well. > > For the OP, the overshoot is 1/2 + G/pi where G is the Gibbs-Wilbraham > constant > > G is the integral of the sync from 0 to pi. > > G =approx 1.8519370519... > > so the overshoot = aprox 1.0894898722... > > So google Gibbs' phenomenom and you will learn some more that will > help you with what Rick put in his book.Clay, I'm confused. The series for a square wave is inf (4/pi)*SUM[(sin(n*w*t)/n] n=1 A brick wall filter removes all but the first term, leaving (4/pi)*sin(w*t) (w is a standin for small omega.) Isn't the peak amplitude then 4/pi = approx 1.273? Jerry -- Engineering is the art of making what you want from things you can get.
Reply by ●May 19, 20112011-05-19
On May 19, 4:21�pm, Jerry Avins <j...@ieee.org> wrote:> On May 19, 2:48�pm, Clay <c...@claysturner.com> wrote: > > > > > > > > As an example, take a filter that presents a 'brick wall' at 2Hz. �Put > > > that square wave into it, and you'll get a sine wave at 1Hz out. �If the > > > filter has unity DC gain, then you'll see some overshoot (I can't > > > remember -- 9%?). �So, just measure or calculate the peak-peak > > > excursion, and adjust the filter gain as necessary. > > > Tim, you remember well. > > > For the OP, the overshoot is 1/2 + G/pi where G is the Gibbs-Wilbraham > > constant > > > G is the integral of the sync from 0 to pi. > > > G =approx 1.8519370519... > > > so the overshoot = aprox 1.0894898722... > > > So google Gibbs' phenomenom and you will learn some more that will > > help you with what Rick put in his book. > > Clay, I'm confused. The series for a square wave is > > � � � �inf > (4/pi)*SUM[(sin(n*w*t)/n] > � � � �n=1 > > A brick wall filter removes all but the first term, leaving > (4/pi)*sin(w*t) (w is a standin for small omega.) Isn't the peak > amplitude then 4/pi = approx 1.273? > > Jerry > -- > Engineering is the art of making what you want from things you can get.- Hide quoted text - > > - Show quoted text -Hello Jerry, Sorry for the confusion. See http://www.claysturner.com/dsp/gibbs.pdf So here you can see a square wave defined to nominally go between 0 and 1. The Gibbs overshoot then goes up to about 1.09 and down to -0.09. If a brickwall high pass filter is used so that all but the fundamental are retained then the over/undershoot is as before. In the case of a brickwall lowpass filter then the amplitude of the fundamental is 2/pi. I believe the series you gave goes between -1 and 1 so yes the amplitude there would be 4/pi. I left in the DC bias in my example so as to not add confusion. Or maybe it does. Clay
Reply by ●May 20, 20112011-05-20
On May 19, 5:01 pm, Clay <c...@claysturner.com> wrote:> On May 19, 4:21 pm, Jerry Avins <j...@ieee.org> wrote: > > > > > > > > > > > On May 19, 2:48 pm, Clay <c...@claysturner.com> wrote: > > > > > As an example, take a filter that presents a 'brick wall' at 2Hz. Put > > > > that square wave into it, and you'll get a sine wave at 1Hz out. If the > > > > filter has unity DC gain, then you'll see some overshoot (I can't > > > > remember -- 9%?). So, just measure or calculate the peak-peak > > > > excursion, and adjust the filter gain as necessary. > > > > Tim, you remember well. > > > > For the OP, the overshoot is 1/2 + G/pi where G is the Gibbs-Wilbraham > > > constant > > > > G is the integral of the sync from 0 to pi. > > > > G =approx 1.8519370519... > > > > so the overshoot = aprox 1.0894898722... > > > > So google Gibbs' phenomenom and you will learn some more that will > > > help you with what Rick put in his book. > > > Clay, I'm confused. The series for a square wave is > > > inf > > (4/pi)*SUM[(sin(n*w*t)/n] > > n=1 > > > A brick wall filter removes all but the first term, leaving > > (4/pi)*sin(w*t) (w is a standin for small omega.) Isn't the peak > > amplitude then 4/pi = approx 1.273? > > > Jerry > > -- > > Engineering is the art of making what you want from things you can get.- Hide quoted text - > > > - Show quoted text - > > Hello Jerry, > > Sorry for the confusion. > > Seehttp://www.claysturner.com/dsp/gibbs.pdf > > So here you can see a square wave defined to nominally go between 0 > and 1. > > The Gibbs overshoot then goes up to about 1.09 and down to -0.09. > > If a brickwall high pass filter is used so that all but the > fundamental are retained then the over/undershoot is as before. > > In the case of a brickwall lowpass filter then the amplitude of the > fundamental is 2/pi. I believe the series you gave goes between -1 and > 1 so yes the amplitude there would be 4/pi. > > I left in the DC bias in my example so as to not add confusion. Or > maybe it does.If the filter were truly a brick wall (we know that's not possible in the real world) then the cut-off needed to isolate the fundamental could be any frequency greater than the fundamental and less than its second harmonic. The Gibbs ringing is correspondingly variable. It is in any case less than 4/pi and adds to that. Jerry -- Engineering is the art of making what you want from things you can get.
Reply by ●May 20, 20112011-05-20
On 05/19/2011 09:15 PM, Jerry Avins wrote:> On May 19, 5:01 pm, Clay<c...@claysturner.com> wrote: >> On May 19, 4:21 pm, Jerry Avins<j...@ieee.org> wrote: >> >> >> >> >> >> >> >> >> >>> On May 19, 2:48 pm, Clay<c...@claysturner.com> wrote: >> >>>>> As an example, take a filter that presents a 'brick wall' at 2Hz. Put >>>>> that square wave into it, and you'll get a sine wave at 1Hz out. If the >>>>> filter has unity DC gain, then you'll see some overshoot (I can't >>>>> remember -- 9%?). So, just measure or calculate the peak-peak >>>>> excursion, and adjust the filter gain as necessary. >> >>>> Tim, you remember well. >> >>>> For the OP, the overshoot is 1/2 + G/pi where G is the Gibbs-Wilbraham >>>> constant >> >>>> G is the integral of the sync from 0 to pi. >> >>>> G =approx 1.8519370519... >> >>>> so the overshoot = aprox 1.0894898722... >> >>>> So google Gibbs' phenomenom and you will learn some more that will >>>> help you with what Rick put in his book. >> >>> Clay, I'm confused. The series for a square wave is >> >>> inf >>> (4/pi)*SUM[(sin(n*w*t)/n] >>> n=1 >> >>> A brick wall filter removes all but the first term, leaving >>> (4/pi)*sin(w*t) (w is a standin for small omega.) Isn't the peak >>> amplitude then 4/pi = approx 1.273? >> >>> Jerry >>> -- >>> Engineering is the art of making what you want from things you can get.- Hide quoted text - >> >>> - Show quoted text - >> >> Hello Jerry, >> >> Sorry for the confusion. >> >> Seehttp://www.claysturner.com/dsp/gibbs.pdf >> >> So here you can see a square wave defined to nominally go between 0 >> and 1. >> >> The Gibbs overshoot then goes up to about 1.09 and down to -0.09. >> >> If a brickwall high pass filter is used so that all but the >> fundamental are retained then the over/undershoot is as before. >> >> In the case of a brickwall lowpass filter then the amplitude of the >> fundamental is 2/pi. I believe the series you gave goes between -1 and >> 1 so yes the amplitude there would be 4/pi. >> >> I left in the DC bias in my example so as to not add confusion. Or >> maybe it does. > > If the filter were truly a brick wall (we know that's not possible in > the real world) then the cut-off needed to isolate the fundamental > could be any frequency greater than the fundamental and less than its > second harmonic. The Gibbs ringing is correspondingly variable. It is > in any case less than 4/pi and adds to that.The Gibbs ringing _can't_ be variable if you are cleanly omitting harmonics, which is what you do with a brick-wall filter with cutoff not equal to a harmonic. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" was written for you. See details at http://www.wescottdesign.com/actfes/actfes.html






