Reply by Greg June 24, 20092009-06-24
On Jun 22, 1:05=A0pm, dbd <d...@ieee.org> wrote:
> On Jun 22, 8:50 am, Greg <he...@alumni.brown.edu> wrote: > > > ... > > If you can get past my original smart-ass approach to the problem, do > > you think > > my concern is warranted? ... or do I have to stand in the corner with > > Chicken-Little? > > > Hope this helps. > > > Greg > > OPs who post "WARNINGS" shouldn't expect Usenet readers to supply > smileys they have left out.
Thanks for the warning.
> I think the world will little note, nor long remember your narrow > concern about ifft.
Right now it looks like the cardinality of the concerned world is two, soon to be decreased to one.
> The reason you are more concerned than the rest of the world seems to > be that you've caught yourself in a recommendation that didn't work > out the way you expected. That's not such big news. The cure for it if > you do want to be helpful is to not make recommendations without > adequate evaluation or applicable experience. If you haven't flown it, > fly it before you tell others to buy it.
I have used fft and ifft for spectral and temporal interpolation quite a bit. However, I have always used the single input option with the zeros explicitly augmenting the original function. It was only when an OP stubbornly pursued the use of the dual input version that I became shocked and awed at the lack of adequate online help for the task. As two posters have replied: there is a use for the double input version. However, it is not for temporal interpolation.
> Who put you in a corner?
No one. Just a fear remnant from the 1st day of the 5th grade after watching a classmate humiliated by being sent to the the corner wearing a dunce cap and the bubblegum he was chewwing stuck to his nose.
> I always thought Chicken Little was a free > range chicken.
Those were the pre-barbecue days. Greg
Reply by dbd June 22, 20092009-06-22
On Jun 22, 8:50 am, Greg <he...@alumni.brown.edu> wrote:
> ...
> If you can get past my original smart-ass approach to the problem, do > you think > my concern is warranted? ... or do I have to stand in the corner with > Chicken-Little? > > Hope this helps. > > Greg
OPs who post "WARNINGS" shouldn't expect Usenet readers to supply smileys they have left out. I think the world will little note, nor long remember your narrow concern about ifft. The reason you are more concerned than the rest of the world seems to be that you've caught yourself in a recommendation that didn't work out the way you expected. That's not such big news. The cure for it if you do want to be helpful is to not make recommendations without adequate evaluation or applicable experience. If you haven't flown it, fly it before you tell others to buy it. Who put you in a corner? I always thought Chicken Little was a free range chicken. Dale B. Dalrymple
Reply by Greg June 22, 20092009-06-22
On Jun 21, 11:34&#4294967295;am, dbd <d...@ieee.org> wrote:
> On Jun 21, 3:41 am, Greg <he...@alumni.brown.edu> wrote: > > > On Jun 13, 10:14 pm, Greg <he...@alumni.brown.edu> wrote: > > ... > > .> Well, since no one replied, and I can't see how to do it, > .> I'll conclude that ... > > Assumption of disproof by disinterest and inability is the illogical
I assumed you could impute the missing smiley.
> resort of trolls, Chicken-Littles
OK, I shouldn't have used "WARNING". and Usenet wannabe mathematicians. No, never wanted to be.
> An alternate interpretation of the lack of response in the last week > (even from any of the cross-posted groups) to your approach to the > topic of this thread is that readers have determined your attempt at > 'help' to not be of any.
I appreciate your acknowledgement that I was trying to help. What was really bothering me was that, in the past I had recommended the use of ifft for temporal interpolation without giving any details or actually using the MATLAB dual-input implementation myself. In a recent thread a stubborn OP pressed for details of Fourier Interpolation. When others and me got into it, it became apparent that details were subtle and the MATLAB implementation warranted better documentation. Obviously, my approach to bringing it to the attentrion of others was ill-founded. Nevertheless, the problem w.r.t. temporal interpolation still remains. A nonexpert would most likely make two faux pas: 1. For practical work, neglect to use windowing to make the Nyquist component insignificant. 2. Use xint = ifft(fft(x),M), M = integer*length(x) Obviously this does not work. Consequently those who would try this approach should be advised somehow in the documentation. If you can get past my original smart-ass approach to the problem, do you think my concern is warranted? ... or do I have to stand in the corner with Chicken-Little? Hope this helps. Greg
Reply by dbd June 21, 20092009-06-21
On Jun 21, 3:41 am, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 10:14 pm, Greg <he...@alumni.brown.edu> wrote: > ...
.> Well, since no one replied, and I can't see how to do it, .> I'll conclude that ... Assumption of disproof by disinterest and inability is the illogical resort of trolls, Chicken-Littles and Usenet wannabe mathematicians. An alternate interpretation of the lack of response in the last week (even from any of the cross-posted groups) to your approach to the topic of this thread is that readers have determined your attempt at 'help' to not be of any.
> ... > Hope this helps. > Greg
Dale B. Dalrymple
Reply by Greg June 21, 20092009-06-21
On Jun 13, 10:14&#4294967295;pm, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 6:42 pm,Greg<he...@alumni.brown.edu> wrote:
> > An excellent test would be to fft a subsample > > of a complex temporal function and compare using > > the single vs double input versions of ifft for > > interpolating the subsample to reconstruct the > > original. > > > My guess is that even experienced users of fft > > and ifft would have trouble. > > > I will post a test example later. > > %Compare the single and double input versions of the ifft > %for recovering the original complex temporal function > %z0 = x0+i*y0 from the subsampled function zs = xs+i*ys.
Well, since no one replied, and I can't see how to do it, I'll conclude that when zs is complex with a significant Nyquist component, the double input version of ifft is useless for reconstructing z0 via Fourier interpolation. Temporal Fourier Interpolation using the single input version is illustrated below: close all, clear all, clc % A complex time function with a significant Nyquist % component % Sampled Function zs T = 1, Ns = 8 dts = T/Ns, ts = dts*(0:Ns-1)'; df = 1/T, f = df*(0:Ns-1)'; zs = complex(sin(pi* (Ns/2)*df *dts*(0:Ns-1)').^2,... cos(pi*(Ns/2-1)*df *dts*(0:Ns-1)').^2); Zs = fft(zs); % Original Function z0 M = 4*Ns dt = T/M, t = dt*(0:M-1)'; z0 = complex(sin(pi* (Ns/2)*df *dt*(0:M-1)').^2,... cos(pi*(Ns/2-1)*df *dt*(0:M-1)').^2); % Interpolated Function z Z = (M/Ns)*[Zs(1:Ns/2);Zs(Ns/2+1)/2;zeros(M-Ns-1,1); ... Zs(Ns/2+1)/2;Zs(Ns/2+2:Ns)]; z = ifft(Z); err = maxabs(z-z0) % 1.3369e-015 x0 = real(z0); y0 = imag(z0); k=k+1, figure(k) subplot(2,2,1), hold on plot(t,x0,'*-') plot(ts,real(zs),'r--*') ylabel('Real Part') title('Original (Blue) and Subsampled (Red)') subplot(2,2,3), hold on plot(t,y0,'*-') plot(ts,imag(zs),'r--*') ylabel('Imaginary Part)') xlabel('Time (sec)') subplot(2,2,2), hold on plot(t,x0,'*-') plot(t,real(z),'r--*') ylabel('Real Part') title('Original (Blue) and Interpolated (Red)') subplot(2,2,4), hold on plot(t,y0,'*-') plot(t,imag(z),'r--*') ylabel('Imaginary Part)') xlabel('Time (sec)') Hope this helps. Greg
Reply by Greg June 14, 20092009-06-14
On Jun 14, 11:45 am, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 14 Jun, 17:20, Greg <he...@alumni.brown.edu> wrote: > > On Jun 14, 6:35 am, Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote: > > > > On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote: > > > > > > > More transparently > > > > > > > xint = IFFT(g(fft(x)),M); > > > > > > > for this special case. > > > > > > No. x[n] is real-valued, which means its spectrum > > > > > is conjugate symmetric. Your statement above breaks > > > > > that symmetry. > > > > > I don't understand what you mean. The function g > > > > just stands for whatever you did to X = fft(x) > > > > in order to obtain xint. However, I should amend > > > > that to > > > > > xint = real(IFFT(g(fft(x)),M)); > > > > Wrong.
Wrong? That expains EXACTLY what you did! 1. You fooled around with fft(x) 2. You took the ifft using the dual input option 3. You took the real part.
> > > > > > > No warning needed. > > > > > > > That's debatable. See below: > > > > > > > An enlightening but unexceptional example because > > > > > > > 1. x is not complex > > > > > > What does that have to do with anything? > > > > > You had to take the real part in order to > > > > eliminate a significantly sized imaginary > > > > part. > > > > You need to work through *all* the details > > > in the example, particularly the lines > > > > Xx = X; > > > Xx(ceil(N/2):end)=0; > > > > Since x was real-valued, the upper and lower halfs > > > of the spectrum X are conjugate symmetric. These two > > > lines make a copy of the conjugate symmetric spectrum, > > > and then zeros the upper half of that spectrum. > > > What you have written only applies when > > 1. x is real > > Nope. Interpolation by zero-padding in frequency > domain is trival when x is complex-valued.
Talk is cheap. See my complex-valued example.
> > 2. The Nyquist component X(N/2+1) is zero > > It is not obvious how to handle a non-zero coefficient > at the Nyquist frequency.
That is why I posted three ways in the other thread. None of them use the dual input option.
> But that has nothing to do > with where and how you insert the zeros,
It has EVERYTHING to do with where you place the zeros.
> it has to > do with fundamental properties of the DFT.
Indeed. It is those fundamental properties that dictate where you can place the zeros.
> > 3. The frequency component below Nyquist X(N/2) is zero > > This is plain wrong.
I interpret "> > > Xx(ceil(N/2):end)=0;" to include Xx(N/2+1) = 0 % Nyquist Xx(N/2) = 0 % Component below Nyquist When x is real Xx is conjugate symmetric and all info is preserved via Xx(ceil((N+3)/2):end) = 0
> > In other words, you have chopped off two components > > that are already zero in this unexceptional example, > > but are sugnificant in the example that I just posted. > > I don't care about the example you posted.
Too bad. If you tried it you would probably learn something.
> You haven't understood what is a standard technique in DSP.
I understand it perfectly. I'm just trying to point out flaws in common understanding. In particular, when M > N, x is complex valued and X = fft(x) has a nonnegligible Nyquist component, the proper interpolation of x is challenging using the single input version of the ifft. However, trying to use the double input version is ridiculously more complicated.
> Look up I/Q sampling. > > > > Leaving out the DC and Nyquist componenst, > > > Your statement does not eliminate the DC component X(1). > > However, there is no DC in your example. > > The DC and F_Nyquist components have to be treated > separately. They are the only ones that do not > have conjugate symmetric counterparts. It's just > a matter of book-keeping.
The three single input methods I posted don't need to treat DC separately. I don't see why you have to either. Is it because you are using a second input? Since your example doesn't have DC it is not clear what you are implying.
> > > which > > > need to be treated separately, the net effect of > > > this operation is that the resulting time-domain > > > sequence is complex-valued, with a significant > > > imaginary part. > > > I understand that... and that is why you have to take > > the real part at the end. > > > > However, we can repeat the argument, but where > > > one zeros the lower half of the spectrum and keeps > > > the upper half. > > > How you treat the Nyquist component is critical. > > However, there is no Nyquist component in your example. > > C'mon, Greg. You started this thread on the false > assumption that there is no use for the IFFT(X,M) > function. I proved you wrong.
No. You did not. What you did will not work on the complex example that I posted.
> leave it there. Don't pretend that the Nyquist > coefficient has anything at all to do with where > this started.
Pretend? What are you smoking? ... and where can I get some? I'm tired of talking past each other. Just try the double input version of ifft on the example I posted. It poses challenges that are missing in your example. Hope this helps. Greg
Reply by Rune Allnor June 14, 20092009-06-14
On 14 Jun, 17:20, Greg <he...@alumni.brown.edu> wrote:
> On Jun 14, 6:35 am, Rune Allnor <all...@tele.ntnu.no> wrote: > > > > > > > On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote: > > > On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote: > > > > > > More transparently > > > > > > xint = IFFT(g(fft(x)),M); > > > > > > for this special case. > > > > > No. x[n] is real-valued, which means its spectrum > > > > is conjugate symmetric. Your statement above breaks > > > > that symmetry. > > > > I don't understand what you mean. The function g > > > just stands for whatever you did to X &#4294967295;= fft(x) > > > in order to obtain xint. However, I should amend > > > that to > > > > xint = real(IFFT(g(fft(x)),M)); > > > Wrong. > > > > > > > No warning needed. > > > > > > That's debatable. See below: > > > > > > An enlightening but unexceptional example because > > > > > > 1. x is not complex > > > > > What does that have to do with anything? > > > > You had to take the real part in order to > > > eliminate a significantly sized imaginary > > > part. > > > You need to work through *all* the details > > in the example, particularly the lines > > > Xx = X; > > Xx(ceil(N/2):end)=0; > > > Since x was real-valued, the upper and lower halfs > > of the spectrum X are conjugate symmetric. These two > > lines make a copy of the conjugate symmetric spectrum, > > and then zeros the upper half of that spectrum. > > What you have written only applies when > 1. x is real
Nope. Interpolation by zero-padding in frequency domain is trival when x is complex-valued.
> 2. The Nyquist component X(N/2+1) is zero
It is not obvious how to handle a non-zero coefficient at the Nyquist frequency. But that has nothing to do with where and how you insert the zeros, it has to do with fundamental properties of the DFT.
> 3. The frequency component below Nyquist X(N/2) is zero
This is plain wrong.
> In other words, you have chopped off two components > that are already zero in this unexceptional example, > but are sugnificant in the example that I just posted.
I don't care about the example you posted. You haven't understood what is a standard technique in DSP. Look up I/Q sampling.
> > Leaving out the DC and Nyquist componenst, > > Your statement does not eliminate the DC component X(1). > However, there is no DC in your example.
The DC and F_Nyquist components have to be treated separately. They are the only ones that do not have conjugate symmetric counterparts. It's just a matter of book-keeping.
> > which > > need to be treated separately, the net effect of > > this operation is that the resulting time-domain > > sequence is complex-valued, with a significant > > imaginary part. > > I understand that... and that is why you have to take > the real part at the end. > > > However, we can repeat the argument, but where > > one zeros the lower half of the spectrum and keeps > > the upper half. > > How you treat the Nyquist component is critical. > However, there is no Nyquist component in your example.
C'mon, Greg. You started this thread on the false assumption that there is no use for the IFFT(X,M) function. I proved you wrong. Why don't you just leave it there. Don't pretend that the Nyquist coefficient has anything at all to do with where this started. Rune
Reply by Greg June 14, 20092009-06-14
On Jun 14, 6:35 am, Rune Allnor <all...@tele.ntnu.no> wrote:
> On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote: > > On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote: > > > > > More transparently > > > > > xint = IFFT(g(fft(x)),M); > > > > > for this special case. > > > > No. x[n] is real-valued, which means its spectrum > > > is conjugate symmetric. Your statement above breaks > > > that symmetry. > > > I don't understand what you mean. The function g > > just stands for whatever you did to X = fft(x) > > in order to obtain xint. However, I should amend > > that to > > > xint = real(IFFT(g(fft(x)),M)); > > Wrong. > > > > > > No warning needed. > > > > > That's debatable. See below: > > > > > An enlightening but unexceptional example because > > > > > 1. x is not complex > > > > What does that have to do with anything? > > > You had to take the real part in order to > > eliminate a significantly sized imaginary > > part. > > You need to work through *all* the details > in the example, particularly the lines > > Xx = X; > Xx(ceil(N/2):end)=0; > > Since x was real-valued, the upper and lower halfs > of the spectrum X are conjugate symmetric. These two > lines make a copy of the conjugate symmetric spectrum, > and then zeros the upper half of that spectrum.
What you have written only applies when 1. x is real 2. The Nyquist component X(N/2+1) is zero 3. The frequency component below Nyquist X(N/2) is zero In other words, you have chopped off two components that are already zero in this unexceptional example, but are sugnificant in the example that I just posted.
> Leaving out the DC and Nyquist componenst,
Your statement does not eliminate the DC component X(1). However, there is no DC in your example.
> which > need to be treated separately, the net effect of > this operation is that the resulting time-domain > sequence is complex-valued, with a significant > imaginary part.
I understand that... and that is why you have to take the real part at the end.
> However, we can repeat the argument, but where > one zeros the lower half of the spectrum and keeps > the upper half.
How you treat the Nyquist component is critical. However, there is no Nyquist component in your example.
> Ths case, too, will produce a complex-valued time-gnificant > imaginary component. But if you look very closely you > will find: > > 1) The two half-spectra are conjugate symmetric > 2) The resulting time series are conjugates of each other > 3) The total spectrum is the sum of the two half-spectra > 4) The original time series is the sum of two complex > conjugate time series > 5) One can use all these properties to compute the > real-valued time series from knowledge of only > one half of the total spectrum. > > Which was what I did, after having zero-padded the > half-spectrum.
This procedure will not work in the general case. See the example I posted. Greg
Reply by Rune Allnor June 14, 20092009-06-14
On 14 Jun, 00:42, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote: > > > > More transparently > > > > xint = IFFT(g(fft(x)),M); > > > > for this special case. > > > No. x[n] is real-valued, which means its spectrum > > is conjugate symmetric. Your statement above breaks > > that symmetry. > > I don't understand what you mean. The function g > just stands for whatever you did to X &#4294967295;= fft(x) > in order to obtain xint. However, I should amend > that to > > xint = real(IFFT(g(fft(x)),M));
Wrong.
> > > > No warning needed. > > > > That's debatable. See below: > > > > An enlightening but unexceptional example because > > > > 1. x is not complex > > > What does that have to do with anything? > > You had to take the real part in order to > eliminate a significantly sized imaginary > part.
You need to work through *all* the details in the example, particularly the lines Xx = X; Xx(ceil(N/2):end)=0; Since x was real-valued, the upper and lower halfs of the spectrum X are conjugate symmetric. These two lines make a copy of the conjugate symmetric spectrum, and then zeros the upper half of that spectrum. Leaving out the DC and Nyquist componenst, which need to be treated separately, the net effect of this operation is that the resulting time-domain sequence is complex-valued, with a significant imaginary part. However, we can repeat the argument, but where one zeros the lower half of the spectrum and keeps the upper half. Ths case, too, will produce a complex-valued time- domain representation that has a significant imaginary component. But if you look very closely you will find: 1) The two half-spectra are conjugate symmetric 2) The resulting time series are conjugates of each other 3) The total spectrum is the sum of the two half-spectra 4) The original time series is the sum of two complex conjugate time series 5) One can use all these properties to compute the real-valued time series from knowledge of only one half of the total spectrum. Which was what I did, after having zero-padded the half-spectrum. Rune
Reply by Greg June 13, 20092009-06-13
On Jun 13, 6:42 pm, Greg <he...@alumni.brown.edu> wrote:
> On Jun 13, 3:15 pm, Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 13 Jun, 19:46, Greg <he...@alumni.brown.edu> wrote: > > > > More transparently > > > > xint = IFFT(g(fft(x)),M); > > > > for this special case. > > > No. x[n] is real-valued, which means its spectrum > > is conjugate symmetric. Your statement above breaks > > that symmetry. > > I don't understand what you mean. The function g > just stands for whatever you did to X = fft(x) > in order to obtain xint. However, I should amend > that to > > xint = real(IFFT(g(fft(x)),M)); > > > > > No warning needed. > > > > That's debatable. See below: > > > > An enlightening but unexceptional example because > > > > 1. x is not complex > > > What does that have to do with anything? > > You had to take the real part in order to > eliminate a significantly sized imaginary > part. > > > If x[n] is complex-valued time domain > > interpolation becomes even simpler, as one > > can skip the time-domain manipulations > > after the IFFT. > > I disagree. > > > > 2. x does not have a Nyquist component > > > So? If you really want to do time-domain > > interpolation through spectrum-domain > > manipulations, the handling of a non-zero > > Fs/2 coefficient will be debatable no matter > > how one chooses to compute the IFFT. > > Not really. > > An excellent test would be to fft a subsample > of a complex temporal function and compare using > the single vs double input versions of ifft for > interpolating the subsample to reconstruct the > original. > > My guess is that even experienced users of fft > and ifft would have trouble. > > I will post a test example later.
%Compare the single and double input versions of the ifft %for recovering the original complex temporal function %z0 = x0+i*y0 from the subsampled function zs = xs+i*ys. t0 = (1/16)*(0:15)' ; x0 = sin((pi/4)*(0:15)').^2 ; y0 = cos(3*(pi/16)*(0:15)').^2 ; z0 = x0 + i*y0 ; ts = (1/8)*(0:7)' ; xs = sin((pi/2)*(0:7)').^2 ; ys = cos(3*(pi/8)*(0:7)').^2 ; zs = xs + i*ys ; figure subplot(2,1,1), hold on plot(t0,x0,'*-') plot(ts,xs,'r--*') ylabel('Real Part') title('Subsampled Function (Red) ') subplot(2,1,2), hold on plot(t0,y0,'*-') plot(ts,ys,'r--*') ylabel('Imaginary Part)') xlabel('Time (sec)') % Insert code figure subplot(2,1,1), hold on plot(t0,x0,'*-') plot(t0,xint,'r--*') ylabel('Real Part') title('Interpolated Function (Red) ') subplot(2,1,2), hold on plot(t0,y0,'*-') plot(t0,yint,'r--*') ylabel('Imaginary Part)') xlabel('Time (sec)') Have fun! Greg