I'm trying to find the power spectrum of a linearly-ramped sine wave - i.e. one whose frequency is periodically and linearly ramped with time. I feel like this should be a somewhat easy numeric calculation, but I'm having convergence trouble.

RampPeriod = 1/(20*10^3);   
f1 = 80*10^6; (* Megahertz *)
f2 = 85*10^6;
MTriangle[t_] := TriangleWave[{f1, f2}, 1/RampPeriod t]
f = NFourierTransform[Sin[2 \[Pi] MTriangle[t]], t, \[Omega]]* Conjugate[NFourierTransform[Sin[2 \[Pi] MTriangle[t]], t, \[Omega]]]
PowerSpectrum[\[Omega]_] := Evaluate[ComplexExpand@Abs@f] 
Plot[PowerSpectrum[i], {i, f1, f2}]

I get a whole lot of errors from this;

NIntegrate::deorel: The relative error 1.9400506317245316` is larger than expected for the integrand 1. Cos[8.00001*10^7 t] Sin[2 \[Pi] TriangleWave[{80000000,85000000},-20000 Abs[0. -t]]] over {0,\[Infinity]} with DoubleExponentialOscillatory method and tuning parameters, TuningParameters -> {10,5}.
NIntegrate::deoncon: DoubleExponentialOscillatory has failed to converge for the integrand 1. Cos[8.00001*10^7 t] Sin[2 \[Pi] TriangleWave[{80000000,85000000},-20000 Abs[0. -t]]] over {0,\[Infinity]}. DoubleExponentialOscillatory obtained 1.1801377470979004`*^-8 and 19.400506317245316` for the integral and error estimates.
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in t near {t} = {-6.3887*10^56}. NIntegrate obtained -4.75337*10^243 and 4.68529976276202`*^243 for the integral and error estimates.

Can anyone suggest why this is failing so terribly? I'm afraid my knowledge of numeric approximation is basically nonexistant, this really isn't my field.

Edit: so I have modified my question a little bit, I hope people can still see this. Basically I am trying to reproduce what I see on the spectrum analyzer - which is a "forest" of peaks centered around 82.5MHz spaced evenly by 30kHz and all with roughly the same amplitude. The peaks die off rapidly below 80MHz and above 85MHz (the sweep range). I have tried the following, at the suggestion of the commentor below:

FourierWindow[t_, tsize_] := 
  Piecewise[{{0, t > tsize}, {0, t < 0}, {1, 0 <= t <= tsize}}];
MTriangle[t_, tsize_] := 
 TriangleWave[{f1, f2}, 1/RampPeriod t]*FourierWindow[t, tsize]

I.e. just add a "window function" to the triangle wave.

This I can then use regular FourierTransform and it will give me a result, but it doesn't reproduce what I see on the SA, when I plotted it out for a fourier window of tsize=.05 s (i.e. many periods of the triangle wave)

fourier transform

  • $\begingroup$ I just rejected a lengthy addition to your question, because only you should make such edits. If you actually proposed the edit, then please sign in with your user name to edit your question, instead of suggesting is anonymously. Thanks. $\endgroup$
    – bbgodfrey
    Oct 24 '17 at 18:54

A numerical approximation is impossible here. For its Fourier transform to be finite, a real function must be "square integrable": the integral of its square must be finite. In your case, this is not true.

A symbolic Fourier transform can finesse this by expressing the integral in terms of Dirac delta "functions", but these cannot be expressed as machine numbers.

You may find that FourierSeries of a single cycle of your triangle captures what you're trying to elucidate, but I cannot tell from your question.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.