FTw][n_][w_]:=NIntegrate[ax[n][1][t]/.sol2]Exp[i w1 t],{t,0,600}]
Plot[Abs[FTw[1][w1]],{w,1,3}]
Here I'd like to calculate the Fourier transform of a complicated function. I tried to plot it to see its behavior. It can work out the result (although very slow).
But there is warning during calculation, saying that
"NIntegrate converges too slowly;suspect one of the following:singularity,value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small".
After calculation is done, it says
The global error of the strategy GlobalAdaptive has increased more than 400 times. The global error is expected to decrease monotonically after a number of integrand evaluations. Suspect one of the following: the working precision is insufficient for the specified precision goal; the integrand is highly oscillatory or it is not a (piecewise) smooth function; or the true value of the integral is 0. Increasing the value of the GlobalAdaptive option MaxErrorIncreases might lead to a convergent numerical integration.
Here the original functionax[n][1][t]/.sol2
is a group of numerical solutions of some complicated ODEs solved by "NDSolve" function. (n=1,2,3...)
I also plot the integrand (ax[1][1][t]/.sol2 Exp[i w1 t])
choosing w1=0.4\Pi
.
It can be seen that it is really very oscillatory(I plot it again using different w1,and the general behavior of the curve is the same: highly oscillatroy).
So how can I deal with the problem to get a more precise result and get rid of the warning. I know it is a problem of working precision, but I am quite unfamiliar with Mathematica so I really don't know how to set the precision to have a satisfactory result.
If anyone can help, I'd appreciate it very much. And I can provide more information if you want.
(P.S. My original ODEs are really really long(it contains more than 100 equations),so I don't show it here. I think judging from the behavior of the curve someone can have a solution)
"InterpolationPointsSubdivision"
might help, too. $\endgroup$