DSPRelated.com
Forums
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →

FFT with discontinuities...

Started by Luna Moon ●September 8, 2007
On Sep 8, 9:31 pm, Jerry Avins <j...@ieee.org> wrote:
> glen herrmannsfeldt wrote: > > Luna Moon wrote: > > >> I am working on the numerical recovery of functions of functions with > >> discontinuities. > > (snip) > > >> I am taking Fourier transform of the function 1/(-5*i*v)*(1- > >> exp(5*i*v)) > > >> And I am using FFT to do it numerically. (of course in this simple > >> case, things can be done in closed form using the Heaviside function, > >> however, I just want to use the numerical method tested with this > >> simple case to later more complicated situations...) > > >> My question is, is there a way to reduce the "ringing effect" at the > >> discontinuity? > > > If I understand your question right, using more points in the FFT > > will reduce the ringing. > > > I am not sure that I understand, though. Ringing is a real > > problem in real systems, but may also be an artifact of some > > approximations. > > More points will reduce the distance from the discontinuity at which the > ringing becomes evident, but not its amplitude. We have here a prime > example of Gibbs' Phenomenon. > > At a finite sample rate, aliasing will be a problem too, and more points > will reduce that. > > jerry > -- > Engineering is the art of making what you want from things you can get. > =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=
=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF Yes, I cannot increase the number of points by a large measure. How to remedy this within the framework of FFT? I know precisely the location and the magnitude of the jump...
On Sep 8, 8:51 pm, julius <juli...@gmail.com> wrote:
> On Sep 8, 3:27 pm, Luna Moon <lunamoonm...@gmail.com> wrote: > > > > > I am working on the numerical recovery of functions of functions with > > discontinuities. > > > Here is an example: > > >http://img179.imageshack.us/img179/2424/ggggz2.jpg > > > I am taking Fourier transform of the function 1/(-5*i*v)*(1- > > exp(5*i*v)) > > > And I am using FFT to do it numerically. (of course in this simple > > case, things can be done in closed form using the Heaviside function, > > however, I just want to use the numerical method tested with this > > simple case to later more complicated situations...) > > > My question is, is there a way to reduce the "ringing effect" at the > > discontinuity? > > > Thanks! > > A while ago there was a lot of work that considered "recovering" > a signal with missing chunks (in the time domain). If it is known > that the signal is "smooth" in some sense, such as it has low > bandwidth, then one can use alternating projection. > > See http://www-stat.stanford.edu/~donoho/Reports/Oldies/UPSR.pdf > > So it very much depends on your signal model. > > Julius
Thanks! Will have to take a look and see if it is still within the FFT framework...
"Luna Moon" <lunamoonmoon@gmail.com> wrote in message 
news:1189317785.716908.217940@r29g2000hsg.googlegroups.com...
> On Sep 8, 6:02 pm, "operator jay" <n...@none.none> wrote: >> "Luna Moon" <lunamoonm...@gmail.com> wrote in message >> >> news:1189283278.655859.313040@r29g2000hsg.googlegroups.com... >> >> >> >> >I am working on the numerical recovery of functions of functions >> >with >> > discontinuities. >> >> > Here is an example: >> >> >http://img179.imageshack.us/img179/2424/ggggz2.jpg >> >> > I am taking Fourier transform of the function 1/(-5*i*v)*(1- >> > exp(5*i*v)) >> >> > And I am using FFT to do it numerically. (of course in this >> > simple >> > case, things can be done in closed form using the Heaviside >> > function, >> > however, I just want to use the numerical method tested with this >> > simple case to later more complicated situations...) >> >> > My question is, is there a way to reduce the "ringing effect" at >> > the >> > discontinuity? >> >> http://en.wikipedia.org/wiki/Gibbs_phenomenon > > Of course I know it's Gibbs... > > > Suppose I know the location and the precise magnitude of the jump > there, is there a way to remove the Gibbs artifacts...? > > Any remedies within the FFT framework? > > I couldn't increase the number of sample points, because the > sampling > itself is costly... > >
http://en.wikipedia.org/wiki/Gibbs_phenomenon
"Luna Moon" <lunamoonmoon@gmail.com> wrote in message 
news:1189283278.655859.313040@r29g2000hsg.googlegroups.com...
>I am working on the numerical recovery of functions of functions with > discontinuities. > > Here is an example: > > http://img179.imageshack.us/img179/2424/ggggz2.jpg > > I am taking Fourier transform of the function 1/(-5*i*v)*(1- > exp(5*i*v)) > > And I am using FFT to do it numerically. (of course in this simple > case, things can be done in closed form using the Heaviside function, > however, I just want to use the numerical method tested with this > simple case to later more complicated situations...) > > My question is, is there a way to reduce the "ringing effect" at the > discontinuity? > > Thanks! >
The "ringing" is a fact of life and cannot be "removed". But there are many ways to reduce it. Usually it involves "smoothing" or "averaging". If your function truely has discontinuties then you might be interested in some other method such as wavelets. Or if you know the behavior of it then you could convert it into a piecewise function and then extend each piece. So for example, Suppose you have the function 1 if -1 < t < 1 0 else Now you are able to find out that it has discontinuties at -1 and 1 so what you do is break that function into two functions and extend it(probably in a smooth way) f1 = 1 f2 = 0 In this case the fourier transform is easy. Now we just have to recombine them back into the original piecewise function. i.e., f1*heaviside(x + 1)*heaviside(1 - x) + f2*heaviside(x - 1)*heaviside(-1-x) which is just our original function. In this case you can get exact reconstruction because you have essentially removed the discontinuities from your function allowing the fft to give "exact" values. I'm sure there are many things you can do if you really want. There are also other transforms out there that work better with discontinuities... most are going to be more computationally expensive than simply dealing with the gibbs phenomena directly. Jon
On Sep 9, 3:20 pm, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> "Luna Moon" <lunamoonm...@gmail.com> wrote in message > > news:1189283278.655859.313040@r29g2000hsg.googlegroups.com... > > > > >I am working on the numerical recovery of functions of functions with > > discontinuities. > > > Here is an example: > > >http://img179.imageshack.us/img179/2424/ggggz2.jpg > > > I am taking Fourier transform of the function 1/(-5*i*v)*(1- > > exp(5*i*v)) > > > And I am using FFT to do it numerically. (of course in this simple > > case, things can be done in closed form using the Heaviside function, > > however, I just want to use the numerical method tested with this > > simple case to later more complicated situations...) > > > My question is, is there a way to reduce the "ringing effect" at the > > discontinuity? > > > Thanks! > > The "ringing" is a fact of life and cannot be "removed". But there are many > ways to reduce it. Usually it involves "smoothing" or "averaging". > > If your function truely has discontinuties then you might be interested in > some other method such as wavelets. Or if you know the behavior of it then > you could convert it into a piecewise function and then extend each piece. > > So for example, Suppose you have the function > > 1 if -1 < t < 1 > 0 else > > Now you are able to find out that it has discontinuties at -1 and 1 so what > you do is break that function into two functions and extend it(probably in a > smooth way) > > f1 = 1 > f2 = 0 > > In this case the fourier transform is easy. > > Now we just have to recombine them back into the original piecewise > function. > > i.e., f1*heaviside(x + 1)*heaviside(1 - x) + f2*heaviside(x - > 1)*heaviside(-1-x) which is just our original function. > > In this case you can get exact reconstruction because you have essentially > removed the discontinuities from your function allowing the fft to give > "exact" values. > > I'm sure there are many things you can do if you really want. There are also > other transforms out there that work better with discontinuities... most are > going to be more computationally expensive than simply dealing with the > gibbs phenomena directly. > > Jon
I removed it by a trick Please see this image: http://img205.imageshack.us/img205/7763/pppqh8.jpg Interestingly for my case, the undershooting always appear before the jump location. And since I know precisely the jump location, and jump magnitude, I can easily remove the undershooting and ringing artifacts... There is no overshooting after the jump. I guess that's because the function is right continuous. If this statement is correct and general, then I probably have found something useful... which can simplify my work a lot(because that means I don't need to do the trick of removing 1/v, or v/(1+v^2), then adding them back manually at later stage): The statement is: If the function is right continuous, then the Gibbs effect only appears to the left of the jump or discontinuity. Any more thoughts?
On Sep 8, 9:27 pm, Luna Moon <lunamoonm...@gmail.com> wrote:
> I am working on the numerical recovery of functions of functions with > discontinuities. > > Here is an example: > > http://img179.imageshack.us/img179/2424/ggggz2.jpg > > I am taking Fourier transform of the function 1/(-5*i*v)*(1- > exp(5*i*v)) > > And I am using FFT to do it numerically. (of course in this simple > case, things can be done in closed form using the Heaviside function, > however, I just want to use the numerical method tested with this > simple case to later more complicated situations...) > > My question is, is there a way to reduce the "ringing effect" at the > discontinuity?
Increase the number of points and/or utilise any additional info you have that may rule out the ringing excursions for example positivity can help in some cases. You might alternatively consider using a different set of orthogonal basis waveforms better suited to the problem in hand. Smooth sine & cosine FFT struggles with discontinuities. Walsh functions and Hadamard transforms spring to mind as suitable candidates. http://en.wikipedia.org/wiki/Walsh_function Regards, Martin Brown
Luna Moon wrote:
> On Sep 9, 3:20 pm, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote: >> "Luna Moon" <lunamoonm...@gmail.com> wrote in message >> >> news:1189283278.655859.313040@r29g2000hsg.googlegroups.com... >> >> >> >>> I am working on the numerical recovery of functions of functions with >>> discontinuities. >>> Here is an example: >>> http://img179.imageshack.us/img179/2424/ggggz2.jpg >>> I am taking Fourier transform of the function 1/(-5*i*v)*(1- >>> exp(5*i*v)) >>> And I am using FFT to do it numerically. (of course in this simple >>> case, things can be done in closed form using the Heaviside function, >>> however, I just want to use the numerical method tested with this >>> simple case to later more complicated situations...) >>> My question is, is there a way to reduce the "ringing effect" at the >>> discontinuity? >>> Thanks! >> The "ringing" is a fact of life and cannot be "removed". But there are many >> ways to reduce it. Usually it involves "smoothing" or "averaging". >> >> If your function truely has discontinuties then you might be interested in >> some other method such as wavelets. Or if you know the behavior of it then >> you could convert it into a piecewise function and then extend each piece. >> >> So for example, Suppose you have the function >> >> 1 if -1 < t < 1 >> 0 else >> >> Now you are able to find out that it has discontinuties at -1 and 1 so what >> you do is break that function into two functions and extend it(probably in a >> smooth way) >> >> f1 = 1 >> f2 = 0 >> >> In this case the fourier transform is easy. >> >> Now we just have to recombine them back into the original piecewise >> function. >> >> i.e., f1*heaviside(x + 1)*heaviside(1 - x) + f2*heaviside(x - >> 1)*heaviside(-1-x) which is just our original function. >> >> In this case you can get exact reconstruction because you have essentially >> removed the discontinuities from your function allowing the fft to give >> "exact" values. >> >> I'm sure there are many things you can do if you really want. There are also >> other transforms out there that work better with discontinuities... most are >> going to be more computationally expensive than simply dealing with the >> gibbs phenomena directly. >> >> Jon > > I removed it by a trick > > Please see this image: > > http://img205.imageshack.us/img205/7763/pppqh8.jpg > > Interestingly for my case, the undershooting always appear before the > jump location. > > And since I know precisely the jump location, and jump magnitude, > > I can easily remove the undershooting and ringing artifacts... > > There is no overshooting after the jump. > > I guess that's because the function is right continuous. > > If this statement is correct and general, then I probably have found > something useful... which can simplify my work a lot(because that > means I don't need to do the trick of removing 1/v, or v/(1+v^2), then > adding them back manually at later stage): > > The statement is: > > If the function is right continuous, > > then the Gibbs effect only appears to the left of the jump or > discontinuity. > > Any more thoughts?
No. Look at a reconstructed delayed step or broad pulse. In the case of the step, half amplitude is a point of symmetry Jerry -- Engineering is the art of making what you want from things you can get. &macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
> > Please see this image: > > http://img205.imageshack.us/img205/7763/pppqh8.jpg > > Interestingly for my case, the undershooting always appear before the > jump location. > > And since I know precisely the jump location, and jump magnitude, > > I can easily remove the undershooting and ringing artifacts... > > There is no overshooting after the jump. > > I guess that's because the function is right continuous. > > If this statement is correct and general, then I probably have found > something useful... which can simplify my work a lot(because that > means I don't need to do the trick of removing 1/v, or v/(1+v^2), then > adding them back manually at later stage): > > The statement is: > > If the function is right continuous, > > then the Gibbs effect only appears to the left of the jump or > discontinuity. > > Any more thoughts? >
The fourier transform and series converge in the mean. What this means is that isolated points do not matter(think of it because its an integral). So left and right continuity have no effect. Take f(x) = 0 if x <= 0, 1 if x <= 1, else 0 then the fourier transform is int(f(x)*exp(-I*w*x),x=-oo..oo) = int(f(x)*exp(-I*w*x),x=0..1) This is the exact same as if it was f(x) = 0 if x < 0, 1 if x < 1, else 0 or any other value for those discontinuities. You could make them oo if you wanted and it would still give you the same result. I'm not sure exactly what you are doing though. It sounds like you are piecing it together like I mentioned before. If you have a piecewise function then if you break it apart, continuously extend it in some smooth way(C^2 will probably work fine) and then take transform/series and then piece them back together you will end up with exactly the original function back. Why? Because your function converged in the mean so it converged to the correct points on the piecewise curve, even at the "boundaries"(which are no longer boundaries)), since you continuously extended it. So if you know the exact locations of discontinuity you can use that method to recover a transform exactly. (note that this says nothing about the frequency spectrum though as it you will need to keep track of the spectrums of the pieces which means its not a good method for spectrum analysis) Since I'm really not too clear on what your trying to do, besides removing the gibbs phenomena, its hard to say much. In general you can't remove it. You can do things to remove it or reduce it for specific problems though. If you still need some help I wouldn't mind but you'll need to give me your exactly problem in detail. "I am taking Fourier transform of the function 1/(-5*i*v)*(1- exp(5*i*v))" You give that function. I do not know which domain your in. I assume its frequency because normally one has the rectangle function in time and not the other way around... it doesn't matter because of duality though. But any ways, I have given you an easy specific method to completely remove ringing for rectangular functions. If you know that your only dealing with rectangular functions then its quite easy. You don't even have to take the transform. (assuming some regularity conditions) When you speak of ringing though you mean in the same domain. So if you have the rectangular function in time then you wnt to remove the ringing produced when taking a finite fourier transform or series back in the time domain. Again, in the specific case of rectangular functions you don't have to worry bout this(actually depends on your problem). Its also true in general as I have pointed out several times. Take the function f(x) = 0 if x < 0, 1 - x^2 if x < 1, else 0 if we take transform/series we get "ringing". But since we know there is a discontinuity at 0, lets decompose f(x) into two functions, g(x) = 0 for all x h(x) = 1 - x^2 The transform/series of both of these functions have no ringing(approximately as it would be difficult to tell with a finite approximation). Now suppose we take the fourier series of both. For h(x) we do it, say, on [5,5]. suppose h_n(x) is the resulting nth term fourier series for h(x). Obviously the series for g(x) is g(x). So now we just have f_n(x) = 0 if x < 0, h_n if x < 1, else 0 and f_n(x) does not have any ringing just as h_n(x) doesn't have any. It should be obvious why this works cause we are not treating f(x) as a function with discontinuities but a piecewise continuous function but computing the transform/series on each piece in a special way(by continuously extending them). Anyways... time for bed ;) Jon
On Sep 8, 4:27 pm, Luna Moon <lunamoonm...@gmail.com> wrote:
> I am working on the numerical recovery of functions of functions with > discontinuities. > > Here is an example: > > http://img179.imageshack.us/img179/2424/ggggz2.jpg > > I am taking Fourier transform of the function 1/(-5*i*v)*(1- > exp(5*i*v)) > > And I am using FFT to do it numerically. (of course in this simple > case, things can be done in closed form using the Heaviside function, > however, I just want to use the numerical method tested with this > simple case to later more complicated situations...) > > My question is, is there a way to reduce the "ringing effect" at the > discontinuity?
There are all sorts of ways to reduce the "ringing". But it's only really a generalized thing in terms of ideal, uniform, sampling. And there you use windowing. Hamming, and Oppenheimer&Schafer wrote some the classical books on the subject. But there are all sorts of other texts on the subject today.
> > Thanks!