# Fourier Transform plot of a piecewise function

I'm working with financial data. I used "Find Formula" to find an approximate function and then I applied FourierTransform to it. Here are the function and the Fourier Transform:

Piecewise[{{-(0.000025535553901890394*x^3) + 0.02627291228784321*x^2 - 2.4718313381236383*x + 6613.444314492878, Inequality[0, LessEqual, x, Less, 180.63799223782598]},
{-(0.000024827301823201077*x^3) + 0.025612019235675774*x^2 - 1.6524680198482025*x + 6673.441026313368, Inequality[180.63799223782598, LessEqual, x, Less, 754.]},
{8.146107735777057*^-10*x^5 - 4.863008306471559*^-6*x^4 + 0.011447005002344341*x^3 - 13.254665570903722*x^2 + 7538.799913755797*x - 1.672702391929518*^6, Inequality[754., LessEqual, x, Less, 1507.]}}]

FourierTransform[myfunction, x, ω, FourierParameters -> {0, -2*Pi}] // FullSimplify
1/ω^6 (ω^2 (-1.00612*10^-7 + ω ((0. + 0.000216807 I) + (0.0448746 - (0. + 1048.16 I) ω) ω)) + E^((0. - 9468.76 I) ω) ((1.58874*10^-12 + 1.79366*10^-43 I) + ω ((4.1359*10^-25 +
3.125*10^-9 I) + ω ((-2.43689*10^-6 - 1.38063*10^-21 I) + ω ((6.02389*10^-19 - 0.000905295 I) + ((0.323991 - 4.44089*10^-16 I) - (9.09495*10^-13 - 2100.38 I) ω) ω)))) + E^((0. - 4737.52 I) ω) (-1.58874*10^-12 + ω ((0. +
4.39169*10^-9 I) + ω (5.534*10^-6 + ω \((1.30104*10^-18 - 0.00343142 I) + (-1.47173 + (7.10543*10^-15 - 57.394 I) ω) ω)))))


I tried to plot the Fourier Transform but the output is an empty plot. How could I fix this?

• Your function has both real and imaginary parts. Do you want to plot the modulus-squared of this complex function? Then plot Abs[ft]^2 instead, where ft is your expression. The function diverges at $\omega = 0$, it seems. Dec 13, 2017 at 19:19

Your function is a bit weird... Anyway, I have tried to reduce the accuracy of your Fourier Transform and plot the Abs and Arg of it:

ft = FourierTransform[myfunction, x, ω,
FourierParameters -> {0, -2*Pi}] //
ComplexExpand[#, TargetFunctions -> {Re, Im}] & // Simplify //
Chop[#, 10^-5] &


$$-\frac{0.00344496 \sin (4737.52 \omega )}{\omega ^3}-\frac{0.000905295 \sin (9468.76 \omega )}{\omega ^3}+\frac{0.0626122}{\omega ^2}+\frac{0.323991 \cos (9468.76 \omega )}{\omega ^2}-\frac{0.0164629 \cos (1134.98 \omega )}{\omega ^2}-\frac{1.46102 \cos (4737.52 \omega )}{\omega ^2}+\frac{2100.38 \sin (9468.76 \omega )}{\omega }-\frac{30.3372 \sin (1134.98 \omega )}{\omega }-\frac{55.5353 \sin (4737.52 \omega )}{\omega }+i \left(\frac{0.000211835}{\omega ^3}-\frac{0.00344496 \cos (4737.52 \omega )}{\omega ^3}-\frac{0.000905295 \cos (9468.76 \omega )}{\omega ^3}+\frac{0.0164629 \sin (1134.98 \omega )}{\omega ^2}+\frac{1.46102 \sin (4737.52 \omega )}{\omega ^2}-\frac{0.323991 \sin (9468.76 \omega )}{\omega ^2}-\frac{1052.56}{\omega }-\frac{30.3372 \cos (1134.98 \omega )}{\omega }+\frac{2100.38 \cos (9468.76 \omega )}{\omega }-\frac{55.5353 \cos (4737.52 \omega )}{\omega }\right)$$

GraphicsRow[{Plot[myfunction, {x, 0, 1600}],
Plot[Evaluate@AbsArg[ft], {ω, -1, 1}, PlotPoints -> 40,
ScalingFunctions -> "Log", PlotRange -> {0.01, 10^7}]}, ImageSize -> Large]


• Thanks for the help, but what if I want to plot only the real part of the function. Because when i tried to separate the real part from the imaginary one, the Fourier transform output still contains the imaginary part. Dec 15, 2017 at 11:25
• In my result you have the real part already. See that in ComplexExpand I request that MMA separates Re and Im. Dec 15, 2017 at 11:26
• I used your code but my output is quite different from yours, mine doesn't separate the real and imaginary part. What could be the problem? Dec 15, 2017 at 14:56