Re: numerical fourier transform of an error function



On Mon, 21 Jan 2008 17:14:02 +0000 (UTC), "Jianjun "
<jianjunp@xxxxxxxxxxxxx> wrote:

I am trying to evaluate a fourier transform of an error
function f(x)=erf(x+16)-erf(x-16);
I used subs(maple('fourier',erf(x+16)-erf(x-16),x,w),w,
[0:0.001:1]');
All I need is get the value of w at [0:0.001:1] region.
Because the fourier transfrm of error function is not
explicit,it only gives me something like
{snipped}
Could anyone tell me how to obtain the nemerical value of
this problem? Thank you all in advance.

The erf() can't be evaluated in closed form in terms of elementary
functions. According to the following, it can be evaluated in terms of
a Taylor series:
http://en.wikipedia.org/wiki/Error_function

That is too hideous to contemplate, so to get a numerical answer, it
would be easier to give a numeric range to f(x). This is easier if you
think about what the function looks like - it is the difference of two
erf curves, one shifted to the left by 16, and one shifted to the
right by the same amount. When the difference is taken, what is seen
is a function that rises quickly around -16 from zero to two, and then
decreases quickly from two to zero around +16. If you assign an x
range of +/- 20 to x, you will get virtually all of the change in the
curve (within 4 sigma, speaking loosely).
With the resulting vector, you can take a numeric fft and see what
pops out.

I made up this m-file to show the function and its fft:

x = -20 : .001 : 20; %x vector
L= length(x);
xrf = erf(x+16)-erf(x-16); % f(x)
plot(x,erf(x+16),x,erf(x-16),x,xrf); % picture f(x)
figure

% this copied from Matlab fft help with variable names modified...

NFFT = 2^nextpow2(L); % Next power of 2 from length of x
XRF = fft(xrf,NFFT)/L;
f = L/2*linspace(0,1,NFFT/2);

% Plot single-sided amplitude spectrum.
plot(f,2*abs(XRF(1:NFFT/2)))
title('Single-Sided Amplitude Spectrum of f(x)')
xlabel('Units?')
ylabel('|XRF(f)|')

XRF(1:NFFT/2); % print the numbers if desired


The scaling depends on what values of time are assigned to x = -20:20,
and what sample rate. I'll leave it to you to figure the scaling to
get the numeric values you need in w = 0 to 1. You'll probably need to
play with the input resolution.
.



Relevant Pages

  • Re: Does Matlab do FFT correctly ?
    ... Look at your data carefully before doing the FFT. ... exactly zero. ... I am looking at the Fourier phase of signals and images. ... We all know that the DFT of a square pulse is a sinc. ...
    (comp.soft-sys.matlab)
  • Re: Does Matlab do FFT correctly ?
    ... Look at your data carefully before doing the FFT. ... exactly zero. ... I am looking at the Fourier phase of signals and images. ... We all know that the DFT of a square pulse is a sinc. ...
    (comp.soft-sys.matlab)
  • Re: Cubic Spline Interpolation and Zero Crossing Analysis
    ... crossings but I'm sure that I would get less noisy ... using a cubic spline interpolation. ... might try using an FFT to upsample. ... of the zero crossings. ...
    (comp.dsp)
  • Re: Does Matlab do FFT correctly ?
    ... Chen Sagiv ... Look at your data carefully before doing the FFT. ... exactly zero. ... Is that a known "feature" of Matlab? ...
    (comp.soft-sys.matlab)
  • Re: Cubic Spline Interpolation and Zero Crossing Analysis
    ... crossings but I'm sure that I would get less noisy ... using a cubic spline interpolation. ... Use an FFT, but don't bother upsampling. ... of the zero crossings. ...
    (comp.dsp)