2 responded to commentor
source | link

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.

Thanks!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

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.

Thanks!

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

1
source | link

Power spectrum of ramped sine wave, does not converge

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.

Thanks!