DSPRelated.com
Forums

how to decide a good sampling rate for sampling a function without obvious frequency?

Started by lucy August 15, 2004
"Derek Goring" <nztideman@yahoo.co.nz> wrote in message
news:d94b83b8.0408161429.1d702ce9@posting.google.com...
> "lucy" <losemind@yahoo.com> wrote in message
news:<cfqusi$mif$1@news.Stanford.EDU>...
> > "Derek Goring" <nztideman@yahoo.co.nz> wrote in message > > news:d94b83b8.0408152329.2b13a3fb@posting.google.com... > > > "lucy" <losemind@yahoo.com> wrote in message > > news:<cfp1n4$bp4$1@news.Stanford.EDU>... > > > <snip> > > > >Lucy is trying to fit a round peg into a square hole > > > > > > gaussian(x, > > y)=1/(2*pi*sigmax*sigmay)*exp(-0.5*(x^2/sigmax^2+y^2/sigmay^2)); > > > > > > > > In my experiments using Matlab, I am using square grids to
deiscretize
> > the > > > > above function. > > > > > > This is your problem right here. > > > Why are you using square grids? > > > What's so special about them, especially since what you're > > > discretising is naturally a cylindrical polar shape? > > > As well as that, you need greater resolution near the centre and less > > > at the edges, so your cylindrical polar grid needs to have radial > > > spacing that is a function of the radius. > > > > > > Perhaps you could tell us what your application is? > > > What will you do with the Gaussian, once you've discretised it? > > > > I need to use these sampled grids for 2D convolution... if I use a > > non-uniform sampling, how can I handle the subsequent 2D convolution > > operation? > > > > I am intested in learning that if the non-uniform sampling can handle > > convolution after the discretization? > > > > Thank you very much! > > > > -Lucy > > So, once you've discretised, you'll transform to the frequency domain > to do the convolution, right? But your function is continuous, so why > not do the Fourier transform analytically and discretise in the > frequency domain?
FYI, The conv2 in Matlab is 10 times slower than if I do ifft2(fft2(A).*fft2(B))), but the latter is 100 times slower than first do 1D filter on rows then do 1D filter on columns,...
> But your function is continuous, so why > not do the Fourier transform analytically and discretise in the > frequency domain?
This is really a good suggestion, suppose I do everything Fourier Transform analytically and the overall computation result is discreteized in the frequency domain, how do I convert the frequency domain samples back to time-domain to get my time-domain results? Thanks a lot, -Lucy
lucy wrote:

> "Derek Goring" <nztideman@yahoo.co.nz> wrote in message > news:d94b83b8.0408161429.1d702ce9@posting.google.com... > >>"lucy" <losemind@yahoo.com> wrote in message > > news:<cfqusi$mif$1@news.Stanford.EDU>... > >>>"Derek Goring" <nztideman@yahoo.co.nz> wrote in message >>>news:d94b83b8.0408152329.2b13a3fb@posting.google.com... >>> >>>>"lucy" <losemind@yahoo.com> wrote in message >>> >>> news:<cfp1n4$bp4$1@news.Stanford.EDU>... >>> >>>><snip> >>>> >>>>>Lucy is trying to fit a round peg into a square hole >>> >>>>>gaussian(x, >>> >>> y)=1/(2*pi*sigmax*sigmay)*exp(-0.5*(x^2/sigmax^2+y^2/sigmay^2)); >>> >>>>>In my experiments using Matlab, I am using square grids to > > deiscretize > >>> the >>> >>>>>above function. >>>> >>>>This is your problem right here. >>>>Why are you using square grids? >>>>What's so special about them, especially since what you're >>>>discretising is naturally a cylindrical polar shape? >>>>As well as that, you need greater resolution near the centre and less >>>>at the edges, so your cylindrical polar grid needs to have radial >>>>spacing that is a function of the radius. >>>> >>>>Perhaps you could tell us what your application is? >>>>What will you do with the Gaussian, once you've discretised it? >>> >>>I need to use these sampled grids for 2D convolution... if I use a >>>non-uniform sampling, how can I handle the subsequent 2D convolution >>>operation? >>> >>>I am intested in learning that if the non-uniform sampling can handle >>>convolution after the discretization? >>> >>>Thank you very much! >>> >>>-Lucy >> >>So, once you've discretised, you'll transform to the frequency domain >>to do the convolution, right? But your function is continuous, so why >>not do the Fourier transform analytically and discretise in the >>frequency domain? > > > FYI, The conv2 in Matlab is 10 times slower than if I do > ifft2(fft2(A).*fft2(B))), > > but the latter is 100 times slower than first do 1D filter on rows then do > 1D filter on columns,... > > > >>But your function is continuous, so why >>not do the Fourier transform analytically and discretise in the >>frequency domain? > > > This is really a good suggestion, suppose I do everything Fourier Transform > analytically and the overall computation result is discreteized in the > frequency domain, > > how do I convert the frequency domain samples back to time-domain to get my > time-domain results? > > Thanks a lot, > > -Lucy > >
Inverse FFT. You should be able to do an FFT on your data, then do an IFFT on the result, and get your data back. Or do an FFT on your data, filter it in the frequency domain (by multiplication) and IFFT back. This works just as well for the 2D FFT as for 1D. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com