Hello, Please consider the following code: maximum_time = 2; t_s = 0.01; no_of_samples = maximum_time/t_s; f_s = 1/t_s; f1 = 30; f2 = 20; t=0:t_s:maximum_time; signal = cos(2*pi*f1*t); signal_Hamming = signal.*hamming(length(signal))'; signal_DFT = fft(signal); signal_Hamming_DFT = fft(signal_Hamming); hold on; plot(abs(signal_DFT),'r'); plot(abs(signal_Hamming_DFT),'k'); What I am trying to do is to minimize the DFT leakage or to get a better resolution of the frequency components. Now the Hamming windowed DFT plot clearly has reduced mainlobe but its peak value is reduced. I am need of a method to get the real value of the peak, i.e. value without windowing.. maybe it is not possible.. but I wanted to know if there anyway I can get close atleast? Basically my real need is, I have a channel impulse response of say 10 samples. Then I DFT this into a frequency response of 128 samples. So I know the frequency response of 128 frequencies. Now, I want to use a reduced number of these frequency points and reconstruct the original channel impulse response. The sequence is: 10-point time domain seq. --> [DFT-128] --> 128-point freq. domain --> [IDFT-64 point] --> 64-point time domain. Now obviously the reconstrcuted time domain values are different from original values (I only want to know the first 10 points).. So I thought maybe windowing can help. Any idea is greatly appreciated. Thank you very much.
How to reconstruct a windowed DFT sequence?
Started by ●January 15, 2009
Reply by ●January 15, 20092009-01-15
Made a mistake here:>10-point time domain seq. --> [DFT-128] --> 128-point freq. domain --> >[IDFT-64 point] --> 64-point time domain.When I say [IDFT-64 point], I mean 128-point, but only 64 non-zero points.. so I am take first 64-points from the 128-point DFT, and do a 128-point IDFT. I.e. with 64 zeros padded, to get the original time-domain resolution. Thank you.
Reply by ●January 15, 20092009-01-15
On 15 Jan, 08:49, "m26k9" <maduranga.liyan...@gmail.com> wrote: ...> What I am trying to do is to minimize the DFT leakage or to get a better > resolution of the frequency components.Define 'resolution'. Do you - want to estimate the frequency of one sinudoidal? - want to resolve two sinusoidals at different frequencies? - something else? What you do is wrong, but the arguments to explain why depends on what you intend to do.> Now the Hamming windowed DFT plot > clearly has reduced mainlobe but its peak value is reduced.I have no ideal waht you mean by this. The windows reduce peak side lobe levels at the expense of wider main lobes. They may also seripusly mess up the appearance of comlicated spectra.> I am need of a method to get the real value of the peak, i.e. value > without windowing.. maybe it is not possible.. but I wanted to know if > there anyway I can get close atleast?Again, what are you trying to do and why? If you want parameters from the 'raw' sepctrm then don't use the window function in the first place.> Basically my real need is, I have a channel impulse response of say 10 > samples. Then I DFT this into a frequency response of 128 samples. So I > know the frequency response of 128 frequencies. Now, I want to use a > reduced number of these frequency points and reconstruct the original > channel impulse response.What you try to do makes no sense to me, but provided the impulse response is zero-padde by an integer factor, that id, Nzeros = m*N where m is an integer and N is the original number of samples, then all you need to do is to pick every m'th coefficient of the spectrum and feed them to an N-pt IFFT, possibly with some scaling factors, and the original impulse response should pop right back at you. But again, doing that is nothing more than a very awkward detour that makes little if any sense. Rune
Reply by ●January 15, 20092009-01-15
On Thu, 15 Jan 2009 01:49:20 -0600, "m26k9" <maduranga.liyanage@gmail.com> wrote:>Hello, > >Please consider the following code: > >maximum_time = 2; >t_s = 0.01; >no_of_samples = maximum_time/t_s; >f_s = 1/t_s; >f1 = 30; >f2 = 20; > >t=0:t_s:maximum_time; > >signal = cos(2*pi*f1*t); >signal_Hamming = signal.*hamming(length(signal))'; > >signal_DFT = fft(signal); >signal_Hamming_DFT = fft(signal_Hamming); > >hold on; >plot(abs(signal_DFT),'r'); >plot(abs(signal_Hamming_DFT),'k'); >Hello m26k9, I'm sure someone here can help you, but only if we know exactly (precisely) what it is you're trying to do.>What I am trying to do is to minimize the DFT leakage or to get a better >resolution of the frequency components.Minimizing leakage and improving spectral granularity are two different things. Which of those things do you want to do? Or do you want to do both?>Now the Hamming windowed DFT plot >clearly has reduced mainlobe but its peak value is reduced. > >I am need of a method to get the real value of the peak, i.e. value >without windowing.. maybe it is not possible.. but I wanted to know if >there anyway I can get close atleast?There's a way to do that for a narrow spectral spike whose center resides between two DFT bin centers (when spectral leakage is taking place). It's a simple parabolic equation approximation, but I forget what that equation is. Robert Bristow-Johnson knows how to do it. If you don't receive guidance on this topic please keep bugging us. Once you have the estimated "between bins" spectral peak value (from above), you then multiply that value by 1/0.54 (for the Hamming window) to compensate for the magnitude loss caused by Hamming windowing.> >Basically my real need is, I have a channel impulse response of say 10 >samples. Then I DFT this into a frequency response of 128 samples. So I >know the frequency response of 128 frequencies. Now, I want to use a >reduced number of these frequency points and reconstruct the original >channel impulse response. > >The sequence is: > >10-point time domain seq. --> [DFT-128] --> 128-point freq. domain --> >[IDFT-64 point] --> 64-point time domain. > >Now obviously the reconstrcuted time domain values are different from >original values (I only want to know the first 10 points).. > >So I thought maybe windowing can help. > >Any idea is greatly appreciated.Whew! This is where I'm confused. The second half of your post seems to be unrelated to the first half of your post. You say you have an impulse response sequence, but then you say you want to "reconstruct" that impulse response sequence. What exactly do you mean by "reconstruct"? Not understanding the problem very well here, I'll just suggest you have a look at the following code Maybe it will be of some help: x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; % Orig. time seq. % Obtain interpolated by 128/10 spectrum of "x" Interp_Spec = fft(x, 128); Interp_Spec_Mag = abs(Interp_Spec); % Decimate the interpolated spectrum by 2 DecFactor = 2; Dec_Spec = Interp_Spec(1:DecFactor:length(Interp_Spec)); Dec_Spec_Mag = abs(Dec_Spec); x_New = real(ifft(Dec_Spec)); % Discard imag. parts figure(1) subplot(4,1,1) plot(x, ':bo', 'markersize', 5), grid on ylabel('Orig. time seq.') subplot(4,1,2) plot(Interp_Spec_Mag, ':bo', 'markersize', 5), grid on ylabel('Interp. Spec Mag') subplot(4,1,3) plot(Dec_Spec_Mag, ':bo', 'markersize', 5), grid on ylabel('Dec. Spec Mag') subplot(4,1,4) plot(x_New, ':bo', 'markersize', 5), grid on ylabel('New time seq.') Good Luck, [-Rick-]
Reply by ●January 15, 20092009-01-15
>Made a mistake here: > >>10-point time domain seq. --> [DFT-128] --> 128-point freq. domain --> >>[IDFT-64 point] --> 64-point time domain. > >When I say [IDFT-64 point], I mean 128-point, but only 64 non-zero >points.. so I am take first 64-points from the 128-point DFT, and do a >128-point IDFT. I.e. with 64 zeros padded, to get the originaltime-domain>resolution. > >Thank youHi, Just a quick fix: Use enough zero padding and sum the energy in bands of interest (around the peak). If you fit a parabola to the peak you can get an amplitude estimate, but the widening of the main lobe by the hamming window will leak out energy into side lobes. With a hamming window the leakage will be concentrated more narrow around the main lobe (but you will have more "close-by" leakage, than with a rect window - in other words a wider main lobe). Zero pad to get interpolation and sum up the energy in bins around the peak. Still you have to figure out the best number of bins to sum up. But you can look at the transform of a hamming window for you fft-size to see at how many bins distance the magnitude drops to an insignificant value. gr. Bjoern
Reply by ●January 15, 20092009-01-15
Thank you very much Rune. I'm sorry for the ambiguity. What I am basically trying to do is to reconstruct the time-domain points I started with. Suppose T is an M-point time-domain samples. And then we so an N-point (N>M) DFT. This is will give us N frequency domain values. Ideally; T --> [N-point DFT] --> [N-point IDFT] --> T + (N-M) zeros. Because of a constraint in the design, I cannot do the N-point "IDFT" witj N non-zero samples. I can only use K (M<K<N) contiguous non-zero samples from the original N samples, then pad it with (N-K) zeros and do an IDFT. The problem is these K points must be the first K samples of the N-DFT. The order of M is around 32 points and K is about 512 and N is 1024/2048. Actually what I really want to do is related to OFDM. I want to keep the same system parameters, but need to estimate the channel at smaller time-resolution and keeping the original symbol duration. When I do that, my bandwidth increases, because I need to increase the number of DFT points. To avoid the bandwidth increase, I want to use a less (K) number of non-zero points, so the resulting IDFT will have the original bandwidth. So I was thinking if there is a way to reconstruct the signal back with. Because when I do second DFT with K points, the spectrum spreads out and gets distorted. I know it is pretty ambiguous. Like you said, it probably isnt possible. But any suggestion is appreciated. Thank you very much.
Reply by ●January 15, 20092009-01-15
Dear Rick, Thank you very much for the reply. I will try your code. Yes, what I was saying is confusing about resolution and leakage. It is leakage but it is not because the actual point is in-between the bins. I am not sure whether this is leakage. I hope you understood what I am trying to do from the post above. The original time-domain points I want to get is distorted because I use less number of non-zero DFT points, but pad it with zeros to get the same resolution. In actual, I do not have the copy of time-domain values. I need to calculate with the DFT of the circulalrly convolved data sequence. Come to think of it, it is actually not leakage although it seems like it? Because the problem is I simply don't have the necessary non-zero DFT points to get the resolution I want to achieve. Resolution is there, but the spectrum 'spreads' in to adjacent bins. I am sorry if this is still ambiguous. Please let me know where I should clarify more. Thank you.
Reply by ●January 16, 20092009-01-16
On 16 Jan, 00:42, "m26k9" <maduranga.liyan...@gmail.com> wrote:> Thank you very much Rune. > I'm sorry for the ambiguity. > What I am basically trying to do is to reconstruct the time-domain points > I started with. > > Suppose T is an M-point time-domain samples. And then we so an N-point > (N>M) DFT. This is will give us N frequency domain values. > Ideally; > > T --> [N-point DFT] --> [N-point IDFT] --> T + (N-M) zeros.There is a step missing: T --> pad with N-M zeros -> [N-point DFT] --> [N-point IDFT] --> T + (N-M) zeros.> Because of a constraint in the design, I cannot do the N-point "IDFT" witj > N non-zero samples. I can only use K (M<K<N) contiguous non-zero samples > from the original N samples, then pad it with (N-K) zeros and do an IDFT. > The problem is these K points must be the first K samples of the N-DFT.With zero-padding, you append zeros to the input time domain signal. After the DFT the spectrum contains N non-zero coefficients; you can't tell from the spectrum that the signal was zero-padded. If you IDFT, you will recover the original signal (including the trailing zeros) to within numerical accuracy.> The order of M is around 32 points and K is about 512 and N is 1024/2048. > > Actually what I really want to do is related to OFDM. I want to keep the > same system parameters, but need to estimate the channel at smaller > time-resolution and keeping the original symbol duration. When I do that, > my bandwidth increases, because I need to increase the number of DFT > points. To avoid the bandwidth increase, I want to use a less (K) number of > non-zero points, so the resulting IDFT will have the original bandwidth. So > I was thinking if there is a way to reconstruct the signal back with. > Because when I do second DFT with K points, the spectrum spreads out and > gets distorted.I don't know much about OFDM in particular, but you are hitting the time-bandwidth product, which is the fundamental limit that governs the relation between time resolution and bandwidth. The naive relation is that you trade localized time for increased bandwoidth. However, you can do things a bit roundabout and instead use a longer time signal with relatively low bandwidth, and still get the same time resolution. This is known as 'pulse compression' in radar and sonar applications. It might be that you can use similar ideas to achieve whatever you want with the OFDM scheme. One downside with pulse compression is that you need to know the transmitted signal, so the technique might not be useful with arbitrary comm signals. Rune
Reply by ●January 16, 20092009-01-16
>However, you can do things a bit roundabout and instead use a longer >time signal with relatively low bandwidth, and still get the same >time resolution. This is known as 'pulse compression' in radar and >sonar applications. It might be that you can use similar ideas to >achieve whatever you want with the OFDM scheme. One downside with >pulse compression is that you need to know the transmitted signal, >so the technique might not be useful with arbitrary comm signals. >Thank you so much. Actually I KNOW the transmitted signal. This is about channel estimation and I am doing the DFT on a pilot signal sequence. Yes. Like you said this is a time-bandwidth trade-off so I probably cannot get a good resolution without increasing bandwidth. Could you please give me a lead on the "pulse compression" please.. I will do a search too. if you know any literature, please let me know.. Thanks a million mate... Cheers.
Reply by ●January 16, 20092009-01-16
On 16 Jan, 14:48, "m26k9" <maduranga.liyan...@gmail.com> wrote:> >However, you can do things a bit roundabout and instead use a longer > >time signal with relatively low bandwidth, and still get the same > >time resolution. This is known as 'pulse compression' in radar and > >sonar applications. It might be that you can use similar ideas to > >achieve whatever you want with the OFDM scheme. One downside with > >pulse compression is that you need to know the transmitted signal, > >so the technique might not be useful with arbitrary comm signals. > > Thank you so much. > Actually I KNOW the transmitted signal. This is about channel estimation > and I am doing the DFT on a pilot signal sequence. Yes. Like you said this > is a time-bandwidth trade-off so I probably cannot get a good resolution > without increasing bandwidth.The trick is to increase temporal resolution by increasing the temporal duration of the signal while keeping the bandwidth fixed. Sounds a bit weird, for sure, but the trick is in how you process the recieved data. Matched filters are the obvious first attempt to do this. If you know the pilot sequence, set up a matched filter for it and try and detect it in the recieved data. I don't know comm systems in detail, but you might want to extract these data right at the output of the reciever's ADC.> Could you please give me a lead on the "pulse compression" please.. I will > do a search too. if you know any literature, please let me know..Don't know anything from the textbook literature except van Trees' book from the late '60s. There might be something in specialized radar textbooks (Skolnik wrote what seems to be a classic), but I don't know that literature well enough to point to specifics. Maybe others have better pointers. Apart from that, search for 'matched filter'. Rune






