On Jun 4, 1:44�pm, robert bristow-johnson <r...@audioimagination.com> wrote:> > � � � � � � �N-1 > � � x(t) �= �SUM{ x[n] * sin(pi*(t-n)) / ( N*sin((pi/N)*(t- > n)) ) �} � � �N odd > � � � � � � �n=0 > > � � � � � � �N-1 > � � x(t) �= �SUM{ x[n] * sin(pi*(t-n)) / ( N*tan((pi/N)*(t- > n)) ) �} � � N even > � � � � � � �n=0 >crap. Google wrapped my lines and i didn't realize it. should be N-1 x(t) = SUM{ x[n] sin(pi*(t-n))/( N*sin((pi/N)*(t-n)) ) } N odd n=0 N-1 x(t) = SUM{ x[n] sin(pi*(t-n))/( N*tan((pi/N)*(t-n)) ) } N even n=0
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →
Interpolation of a Discrete Periodic Signal
Started by ●May 23, 2013
Reply by ●June 4, 20132013-06-04
Reply by ●June 5, 20132013-06-05
On Thursday, May 23, 2013 12:05:33 AM UTC-4, dszabo wrote:> So, this was an ongoing discussion in another thread, and it's been going > > on long enough that it probably deserves its own thread. I'm going to > > switch the notation to use 'n' in the time domain and 'k' in the frequency > > domain. > > > > To summarize the problem: > > > > Given a signal x[n] such that x[n+N] = x[n] for all n. x[n] may be > > complex. > > > > Provide a continuous expression x(t) such that x(t) = x[n] for t = n, > > that is bandwidth limited by the Nyquist frequency. > > > > The method I suggested uses a DFT. The idea is to use the IDFT to obtain > > an expression for x[n] that uses sines and cosines. > > > > So the DFT shall be defined as, > > > > X[k] = sum( x[n]*e^(-j*2pi*n*k/N) ) for n = 0 to N-1 (1) > > > > The IDFT shall be defined as, > > > > x[n] = (1/N) * sum( X[k]*e^(j*2pi*n*k/N) ) for k = 0 to N-1 (2) > > > > Now, > > > > e^(-j*2pi*n*(k+N)/N) = e^(-j*2pi*n*k/N) * e^(-j*2pi*n) > > > > Because n is always an integer value, > > > > e^(-j*2pi*n*k/N) = e^(-j*2pi*n*(k+N)/N) (3) > > > > So by extension, > > > > X[k] = X[k+N] (4) > > > > This allows us to modify our definition for the IDFT using (3) and (4), > > > > x[n] = (1/N) * sum( X[k]*e^(j*2pi*n*k/N) ) for k = c to c+N-1 (5) > > > > Where c is any integer. For the purposes of this exercise, it is ideal to > > pick c such that all values of k fall within the Nyquist bandwidth. Lets > > start with the case where N is odd, then c = -(N-1)/2. Rewriting (5), > > > > x[n] = (1/N) * sum( X[k]*e^(j*2pi*n*k/N) ) for k = -(N-1)/2 to (N-1)/2 > > (6) > > > > We now have an expression for x[n] using sines and cosines that can be made > > continuous, > > > > x(t) = (1/N) * sum( X[k]*( cos(2pi*t*k/N) + j*sin(2pi*t*k/N) ) ) for k > > = -(N-1)/2 to (N-1)/2 (7) > > > > Lets examine the case where x[n] is real. In this case, > > > > X[-k] = X*[k] (8) > > > > Where X*[k] is the complex conjugate of X[k]. To simplify this expression, > > lets look at sum of a given k and -k. > > > > X[k] * ( cos(2pi*t*k/N) + j*sin(2pi*t*k/N) ) + X[-k] * ( > > cos(-2pi*t*k/N) + j*sin(-2pi*t*k/N) ) > > > > = 2 * Re(X[k]) * cos(2pi*t*k/N) - 2 * Im(X[k]) * sin(2pi*t*k/N) (9) > > > > Now we can factor out X[0] from (7) and be left with pairs of positive and > > negative k's that can be factored using (9), > > > > x(t) = (1/N) * ( X[0] + 2*sum( Re(X[k])*cos(2pi*t*k/N) - > > Im(X[k])*sin(2pi*t*k/N) ) ) for k = 1 to (N-1)/2 (10) > > > > Equation (10) is the solution for the case where x[n] is real and N samples > > long where N is odd. The derivation for the case where N is even is > > similar. Lets start with (5) with c = -N/2. > > > > x[n] = (1/N) * sum( X[k]*e^(j*2pi*n*k/N) ) for k = -N/2 to (N/2)-1 > > (11) > > > > This need to made to have k pairs at all positive and negative frequencies. > > From (4), > > > > X[-N/2] = (1/2) * ( X[-N/2] + X[N/2] ) (12) > > > > Plugging (12) into (11) and making it continuous, > > > > x(t) = (1/N) * ( X[N/2]*cos(pi*t) + sum( X[k]*(cos(2pi*t*k/N) + > > j*sin(2pi*t*k/N)) ) ) for k = -((N/2)-1) to (N/2)-1 (13) > > > > This can be applied for a real x[n] in a similar fashion as (10) > > > > x(t) = (1/N) * ( X[0] + X[N/2]*cos(pi*t) + 2*sum( > > Re(X[k])*cos(2pi*t*k/N) - Im(X[k])*sin(2pi*t*k/N) ) ) for k = 1 to (N/2)-1 > > (14) > > > > That about does it... Equations (7) and (13) can be used for the case > > where x[n] is complex, and reduce to equations (10) and (14) where x[n] is > > real. > > > > I welcome any feedback on the usefulness, cleanliness and/or clarity of > > this post. > > > > Cheers, > > -DanDan, This stuff is fun, but in terms of practicallity, using frequencies right up to the Nyquist limit results in slowly converging series. I.e., an alternating harmonic series. You end up needing a lot of terms. Try looking at the case where the signal is oversampled and then for the interpolant function use a raised cosine. In this case you trade off excess (unused bandwidth) and quickness of convergence. Clay
Reply by ●June 5, 20132013-06-05
On Wednesday, June 5, 2013 6:39:31 AM UTC-7, cl...@claysturner.com wrote:> > This stuff is fun, but in terms of practicallity, using frequencies right up to the Nyquist limit results in slowly converging series. I.e., an alternating harmonic series. You end up needing a lot of terms. Try looking at the case where the signal is oversampled and then for the interpolant function use a raised cosine. In this case you trade off excess (unused bandwidth) and quickness of convergence.for me, the sole purpose was to define (more like *derive*) the exact interpolation of a periodic waveform that you might have stored in memory. how do you interpolate it when you know the samples, x[n]? that sorta is a practical result. you have to combine the N samples somehow. how? and it does have an unexpected result for N even. r b-j
Reply by ●June 6, 20132013-06-06
>> results in slowly converging series.There is no convergence problem with a _periodic_ signal. Look at it as continuous Fourier transform. Sampled at the correct rate, the Fourier series becomes identical to the signal, and all higher coefficients must be zero because of "bandlimited". Strictly speaking, there isn't even a "problem" with that last bin because the original post asked for>> Provide _a_ continuous expressionWe have not one but two...
Reply by ●June 8, 20132013-06-08
On Thursday, June 6, 2013 12:26:00 PM UTC-4, mnentwig wrote:> >> results in slowly converging series. > > > > There is no convergence problem with a _periodic_ signal. > > Look at it as continuous Fourier transform. Sampled at the correct rate, > > the Fourier series becomes identical to the signal, and all higher > > coefficients must be zero because of "bandlimited". > > > > Strictly speaking, there isn't even a "problem" with that last bin because > > the original post asked for > > >> Provide _a_ continuous expression > > > > We have not one but two...we have an infinite number. the amplitude of the sin(pi*n) component can be anything. unless you mean the _two_ are zero (which removes the term from the equation) and non-zero. r b-j
Reply by ●June 9, 20132013-06-09
True, for a real-valued signal. For complex-valued, only the sign of the frequency is unknown (we get two samples on one cycle of a rotating phasor. Magnitude and phase are known, what's missing is the direction it's spinning).
Reply by ●June 9, 20132013-06-09
On Jun 9, 8:58�am, "mnentwig" <24789@dsprelated> wrote:> True, for a real-valued signal. > For complex-valued, only the sign of the frequency is unknown (we get two > samples on one cycle of a rotating phasor. Magnitude and phase are known, > what's missing is the direction it's spinning).but it's still not just two different cases. that X[N/2] bin, whether it has an imaginary component or not, can be divided between the negative and positive frequencies in any manner as long as the two components add up to X[N/2]. r b-j
Reply by ●June 10, 20132013-06-10
>but it's still not just two different cases. that X[N/2] bin, whether >it has an imaginary component or not, can be divided between the >negative and positive frequencies in any manner as long as the two >components add up to X[N/2].what you are describing is a situation where the signal has _not_ been bandlimited sufficiently (in a Nyquist sense). It _cannot_ be reconstructed, as there are obviously free parameters. With a complex-valued signal and "proper" (that is, one-sided) band-limiting you _can_ reconstruct it unambiguously, if you know whether that last bin is positive or negative frequency. With a real-valued signal and "proper" bandlimiting, the final bin must be zero. With "sloppy" bandlimiting and a real-valued signal there is room only for a [-1 1 -1 1 -1 1...] time domain "cosine" component, but the corresponding "sine" component does not exist.
Reply by ●June 11, 20132013-06-11
On Monday, June 10, 2013 12:50:27 AM UTC-4, mnentwig wrote:> >but it's still not just two different cases. that X[N/2] bin, whether > >it has an imaginary component or not, can be divided between the > >negative and positive frequencies in any manner as long as the two > >components add up to X[N/2]. > > what you are describing is a situation where the signal has _not_ been > bandlimited sufficiently (in a Nyquist sense). It _cannot_ be > reconstructed, as there are obviously free parameters. > > With a complex-valued signal and "proper" (that is, one-sided) > band-limiting you _can_ reconstruct it unambiguously, if you know whether > that last bin is positive or negative frequency.well, if it's "one-sided", i guess that imposes the answer to whether the last bin (which bin is that? X[N-1]?) in a one-sided spectrum, i think that all of the bins, by definition, represent non-negative frequency and the vanilla-flavored Dirichlet kernel is valid. the thing that kills me is that the Dirichlet kernel also works for real x[n] (so the spectrum is two-sided) and odd N. but it doesn't work for real x[n] and even N (then you need to change the sin() in the denominator to tan()). that's goofy.> > With a real-valued signal and "proper" bandlimiting, the final bin must be > zero.so then you're saying that you cannot interpolate a general periodic x[n]. but i am asking what do you do with a real periodic x[n] of *any* finite values and x[n+N]=x[n] with N even? what periodic x(t) (where x(t+N)=x(t)) do you come up with that is guaranteed to hit all of the x[n] when t=n. the devil can hand you *any* set of x[n], tell you they are uniformly sampled, that x[n+N]=x[n] for all n, and that N is even. then he requires you to tell him what x(t) is in between samples and there are no frequency components higher than pi in angular frequency. if you get it right, you get to keep your soul. otherwize Screwtape gets to eat it. what do you tell him? think crossroads in Mississippi and my maiden namesake.> With "sloppy" bandlimiting and a real-valued signal there is room only for > a [-1 1 -1 1 -1 1...] time domain "cosine" component, > but the corresponding "sine" component does not exist.no, it can be *any* real B*sin(pi*n) component. B can be any real number and the interpolated x(t) will still go through all of the x[n] discrete points. that's not the same that it "does not exist." what it is, is that you don't know whether or not it exists nor how much of it exists. r b-j







