• Home
  • About Us
  • Contact Us
  • Privacy Policy
  • Special Offers
Business Intelligence Info
  • Business Intelligence
    • BI News and Info
    • Big Data
    • Mobile and Cloud
    • Self-Service BI
  • CRM
    • CRM News and Info
    • InfusionSoft
    • Microsoft Dynamics CRM
    • NetSuite
    • OnContact
    • Salesforce
    • Workbooks
  • Data Mining
    • Pentaho
    • Sisense
    • Tableau
    • TIBCO Spotfire
  • Data Warehousing
    • DWH News and Info
    • IBM DB2
    • Microsoft SQL Server
    • Oracle
    • Teradata
  • Predictive Analytics
    • FICO
    • KNIME
    • Mathematica
    • Matlab
    • Minitab
    • RapidMiner
    • Revolution
    • SAP
    • SAS/SPSS
  • Humor

Tag Archives: Fourier

Making and plotting a Fourier transform

December 2, 2020   BI News and Info

 Making and plotting a Fourier transform

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Read More

Numerically Inverting Characteristic Function with Inverse Fourier Transform

March 29, 2020   BI News and Info
 Numerically Inverting Characteristic Function with Inverse Fourier Transform

I’m trying to numerically invert this characteristic function

 cf = (((-I)*t + n*(\[Lambda] + \[Mu]) - n*Sqrt[-4*\[Lambda]*\[Mu] + (I*t - n*(\[Lambda] + \[Mu]))^2/n^2])/(n*Sqrt[\[Lambda]*\[Mu]*\[Rho]]))^n/2^n

via a numerical Inverse Fourier Transform that looks like this…

 Re[(1/(2*Pi))*NIntegrate[cf/. {\[Lambda] -> 0.5, \[Mu] -> 1, \[Rho] -> 0.5, n -> 5}, {t, -Infinity, 0, Infinity}, Method -> DoubleExponential]]

but I keep on getting errors that the integral cannot be evaluated at the boundaries.
Does anyone have recommendations on how to compute this thing so that I get numerical
values?

Thanks for your assistance.

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Read More

Fourier Transform of a symbolic expression

September 5, 2018   BI News and Info
 Fourier Transform of a symbolic expression

Hello I would like to do the fourier Transform of

Derivative[1][H1][t - L2[t]/c - L2primo[t]/c]

I know that its transform has to be:

i omega H1[omega]* Exp[- I omega (L2[t]/c + L2primo[t]/c)

I have considered L2[t] and L2primo[t] to be constant and not to be transformed…

In order to do that in mathematica I did this function:

Argomentof[e_] := Collect[e[[1, 2 ;;]], -1/c]
myFTd[f_, (q_: 1) expr_, \[Omega]_] := q*I* \[Omega]*f[\[Omega]]*Exp[I \[Omega] Argomentof[expr]];

if I do

myFTd[H1,L2primo[t]Derivative[1][H1][t - L2[t]/c - L2primo[t]/c] Derivative[1][L2][t])/c^2, \[Omega]]

I get:

(I Exp^(I \[omega] L2primo[]) \[Omega] H1[\[Omega]])/c^2

that is wrong…anyone can help?

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Read More

Fourier transform of a complicated function

July 2, 2018   BI News and Info

This question is related to “Numerical Fourier transform of a complicated function” from 2012.

I have pretty much the same problem:
I have a function $ f(x)$ which is complicated to evaluate, and want to calculate
$ $ F(t) = \frac{\mathrm e^t}{\pi} \int_0^\infty f(x)\, \mathrm e^{itx}\; \mathrm dx . $ $
I have sampled $ f(x)$ , for example data see here.
From these points I want to obtain $ F(t)$ .
The problem is: I have tried to do this in 3 different ways, and each gives slightly different results.
I want to know which method is most reliable, and how to best improve accuracy.

If you want to try this yourself, save the example data in a file “samples.txt” and load it:

samples = ToExpression /@
    Import[FileNameJoin[{NotebookDirectory[], "samples.txt"}], "Data"];
samplePlot = ListPlot[{
    Cases[samples, {x_, f_} -> {x, Re[f]}],
    Cases[samples, {x_, f_} -> {x, Im[f]}]},
  PlotTheme -> "Detailed", PlotLegends -> None, PlotRange -> {{0, 200}, Full},
  AspectRatio -> 1/5, ImageSize -> Full, PlotMarkers -> {Automatic, Tiny}]

Method 1: NFourierTransform

My first attempt was to simply use NFourierTransform.
For this, I interpolated my sample data, continuing with zero outside of the sampled domain.
(Note that I convert to an integral $ \int_{-\infty}^\infty$ by setting $ f(-x)=f(x)^\ast$ .)

maxX = 3000;

realParts = Cases[samples, {x_, f_} -> {x, Re[f]}];
imagParts = Cases[samples, {x_, f_} -> {x, Im[f]}];
intRe = Interpolation[realParts];
intIm = Interpolation[imagParts];
interpolation[x_] := 
    Which[Abs[x] >= maxX, 0, x >= 0, intRe[x] + I*intIm[x], True, intRe[-x] - I*intIm[-x]];

Needs["FourierSeries`"];
method1 = Range[-3, 0.75, 0.1] // 10^# & //
  Table[{t, E^t / (2*\[Pi]) * Re@NFourierTransform[
    interpolation[x], x, t, FourierParameters -> {1, 1}]}, {t, #}] &;

plot1 = ListLogLogPlot[method1,
  PlotTheme -> "Detailed", PlotLegends -> None, ImageSize -> Large, 
  PlotStyle -> Black, PlotMarkers -> {Automatic, Small}, PlotRange -> {10^-4, 20}]

Note that this gives negative values $ F(t)$ for the largest $ t$ -values, which should be impossible.

Method 2: DFT

Next I thought, I have discrete data points, I should maybe try a discrete Fourier transformation.
Taking some code from this answer, I did the following:

dx = 0.1;
numpoints = maxX/dx;
upsampled = Range[0, maxX, dx] // Table[interpolation[x], {x, #}] &;

method2 = Re@Fourier[upsampled, FourierParameters -> {1, 1}]*dx //
    RotateRight[#, Floor[(numpoints - 1)/2]] & //
    Transpose@{Range @@ ({-Floor[(numpoints - 1)/2], Ceiling[(numpoints + 1)/2], 1}/(maxX)), #} & //
    Cases[#, {t_, v_} -> {2*\[Pi]*t, E^(2*\[Pi]*t)/\[Pi]*v}] & //
    Interpolation;

plot2 = LogLogPlot[method2[t], {t, 0.001, 5}, PlotRange -> {10^-4, 20},
  PlotTheme -> "Detailed", PlotLegends -> None, ImageSize -> Large]

Note that the original samples are not evenly spaced, I am using the interpolation from above to create more sample points.

Method 3: Fitting

I have found a simpler function which fits the sample data reasonably well:

samplesMirrored = Cases[samples, {t_, f_} -> {-t - 1, Re[f]}] \[Union]
    Cases[samples, {t_, f_} -> {t, Im[f]}];
fitfun[x_] := A1/(1 + B1 + I*x) + A2/(1 + B2 + I*x) + (A3*2!)/(1 + B3 + I*x)^3;
fitfunMirrored[x_] := Evaluate@If[x < -1/2, 
  Evaluate@ComplexExpand@Re[fitfun[-x - 1]], Evaluate@ComplexExpand@Im[fitfun[x]]];
fit = FindFit[
  samplesMirrored,
  {fitfunMirrored[x], B1 > 0, B2 > 0, B3 > 0},
  {{A1, 6.6}, {B1, 15.3}, {A2, 2.7}, {B2, 5.2}, {A3, 1.2}, {B3, 3.5}},
  x];

Show[Plot[{Re@fitfun[x] /. fit, Im@fitfun[x] /. fit}, {x, 0, 20}, 
  PlotTheme -> "Detailed", PlotLegends -> None, ImageSize -> Large], samplePlot]
Show[Plot[{Re@fitfun[x] /. fit, Im@fitfun[x] /. fit}, {x, 1000, 3000},
  PlotTheme -> "Detailed", PlotLegends -> None, ImageSize -> Large], samplePlot]

The whole “mirrored“-business just deals with the fact that FindFit can’t handle complex functions.
The fit function can be Fourier transformed analytically:

method3[t_] := A1*E^(-B1*t) + A2*E^(-B2*t) + A3*t^2*E^(-B3*t) /. fit;
plot3 = LogLogPlot[method3[t], {t, 0.001, 5}, PlotRange -> {10^-4, 20},
  PlotTheme -> "Detailed", PlotLegends -> None, ImageSize -> Large, PlotStyle -> Orange]

The results look as follows (black dots: NFourierTransform, blue: DFT, orange: Fit):
hSY7O Fourier transform of a complicated function

As you can see, the methods agree for intermediate values of $ t$ and I would be certain enough that the result there is correct.
However, I need $ F(t)$ ideally for the whole range of $ t$ -values that is displayed here.
What do you think: is one of these three methods more trustworthy than the others?
If not, what would be the best way to increase the accuracy? (I did experiment a bit with taking more sample points, but it didn’t immediately seem to help too much.)

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Read More

Comparing ordinates between FourierTransform[] and Fourier[]

October 26, 2016   BI News and Info

I have a test function ff[t_] := Exp[-t^2 - t]. I have calculated the Fourier transform with FourierTransform[]:

f[\[Omega]_] = FourierTransform[Exp[-t^2 - t], t, \[Omega], FourierParameters -> {1, 1}]

hAdjE Comparing ordinates between FourierTransform[] and Fourier[]

Then, I have calculated the Fourier transform with Fourier[]:

time = Range[1, 1000, 0.1];
Fa = Table[ff[time[[i]]], {i, 1, 1000}];
dF = Fourier[Fa, FourierParameters -> {1, 1}];
ListLinePlot[Abs[dF]]

plWhe Comparing ordinates between FourierTransform[] and Fourier[]

I know how to get the DFT with the x-axis represented by the frequency.

(I’d need some examples representing the relationship between FT continues and DFT.) Why do not coincide me the values ​​on the ordinate between Fourier[] and FourierTransform[]? is a problem of the directive FourierParameters?

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Read More
  • Recent Posts

    • NOT WHAT THEY MEANT BY “BUILDING ON THE BACKS OF….”
    • Why Healthcare Needs New Data and Analytics Solutions Before the Next Pandemic
    • Siemens and IBM extend alliance to IoT for manufacturing
    • Kevin Hart Joins John Hamburg For New Netflix Comedy Film Titled ‘Me Time’
    • Who is Monitoring your Microsoft Dynamics 365 Apps?
  • Categories

  • Archives

    • February 2021
    • January 2021
    • December 2020
    • November 2020
    • October 2020
    • September 2020
    • August 2020
    • July 2020
    • June 2020
    • May 2020
    • April 2020
    • March 2020
    • February 2020
    • January 2020
    • December 2019
    • November 2019
    • October 2019
    • September 2019
    • August 2019
    • July 2019
    • June 2019
    • May 2019
    • April 2019
    • March 2019
    • February 2019
    • January 2019
    • December 2018
    • November 2018
    • October 2018
    • September 2018
    • August 2018
    • July 2018
    • June 2018
    • May 2018
    • April 2018
    • March 2018
    • February 2018
    • January 2018
    • December 2017
    • November 2017
    • October 2017
    • September 2017
    • August 2017
    • July 2017
    • June 2017
    • May 2017
    • April 2017
    • March 2017
    • February 2017
    • January 2017
    • December 2016
    • November 2016
    • October 2016
    • September 2016
    • August 2016
    • July 2016
    • June 2016
    • May 2016
    • April 2016
    • March 2016
    • February 2016
    • January 2016
    • December 2015
    • November 2015
    • October 2015
    • September 2015
    • August 2015
    • July 2015
    • June 2015
    • May 2015
    • April 2015
    • March 2015
    • February 2015
    • January 2015
    • December 2014
    • November 2014
© 2021 Business Intelligence Info
Power BI Training | G Com Solutions Limited