Skip to main content

As an answer to my code I will getgenerate a periodic discrete data representing a time dependent function called "data" whichand I want to getapply a Discretediscrete Fourier transform of itto this data using just one period of it,but.

I think some thingsomething is wrong with the way I domy Fourier transform.here is my code:

a = 0.05; L = 15; T = 20 \[Pi]; hdc = 2.1;
sol = NDSolve[{a*D[u[t, x], t] == D[u[t, x], x, x] - Sin[u[t, x]], 
u[0, x] == 0, Derivative[0, 1][u][t, 0] == Tanh[t/0.01]*hdc, 
Derivative[0, 1][u][t, L] == 0}, u, {t, 0, T}, {x, 0, L}, 
MaxStepSize -> 0.005, MaxSteps -> 10^6];
q := NIntegrate[( 
Evaluate[First[Derivative[1, 0][u][tp, x] /. sol]])^2, {x, 0, L},
Method -> "LocalAdaptive", MinRecursion -> 50, 
MaxRecursion -> 100];
data = Parallelize[Table[q, {tp, 25.8, T, 0.5}]];
ListLinePlot[data, PlotRange -> All]
ListLinePlot[Abs[Fourier[data]]]

enter image description here enter image description here

As an answer to my code I will get a periodic discrete time dependent function called "data" which I want to get a Discrete Fourier transform of it using just one period of it,but I think some thing is wrong with the way I do Fourier transform.here is my code:

a = 0.05; L = 15; T = 20 \[Pi]; hdc = 2.1;
sol = NDSolve[{a*D[u[t, x], t] == D[u[t, x], x, x] - Sin[u[t, x]], 
u[0, x] == 0, Derivative[0, 1][u][t, 0] == Tanh[t/0.01]*hdc, 
Derivative[0, 1][u][t, L] == 0}, u, {t, 0, T}, {x, 0, L}, 
MaxStepSize -> 0.005, MaxSteps -> 10^6];
q := NIntegrate[( 
Evaluate[First[Derivative[1, 0][u][tp, x] /. sol]])^2, {x, 0, L},
Method -> "LocalAdaptive", MinRecursion -> 50, 
MaxRecursion -> 100];
data = Parallelize[Table[q, {tp, 25.8, T, 0.5}]];
ListLinePlot[data, PlotRange -> All]
ListLinePlot[Abs[Fourier[data]]]

enter image description here enter image description here

I generate a periodic discrete data representing a time dependent function and I want to apply a discrete Fourier transform to this data using just one period of it.

I think something is wrong with my Fourier transform code:

a = 0.05; L = 15; T = 20 \[Pi]; hdc = 2.1;
sol = NDSolve[{a*D[u[t, x], t] == D[u[t, x], x, x] - Sin[u[t, x]], 
u[0, x] == 0, Derivative[0, 1][u][t, 0] == Tanh[t/0.01]*hdc, 
Derivative[0, 1][u][t, L] == 0}, u, {t, 0, T}, {x, 0, L}, 
MaxStepSize -> 0.005, MaxSteps -> 10^6];
q := NIntegrate[( 
Evaluate[First[Derivative[1, 0][u][tp, x] /. sol]])^2, {x, 0, L},
Method -> "LocalAdaptive", MinRecursion -> 50, 
MaxRecursion -> 100];
data = Parallelize[Table[q, {tp, 25.8, T, 0.5}]];
ListLinePlot[data, PlotRange -> All]
ListLinePlot[Abs[Fourier[data]]]

enter image description here enter image description here

added 162 characters in body
Source Link
PlatoManiac
  • 14.9k
  • 2
  • 43
  • 75

As an answer to my code I will get a periodic discrete time dependent function called "data" which I want to get a Discrete Fourier transform of it using just one period of it,but I think some thing is wrong with the way I do Fourier transform.here is my code:

a = 0.05; L = 15; T = 20 \[Pi]; hdc = 2.1;
sol = NDSolve[{a*D[u[t, x], t] == D[u[t, x], x, x] - Sin[u[t, x]], 
u[0, x] == 0, Derivative[0, 1][u][t, 0] == Tanh[t/0.01]*hdc, 
Derivative[0, 1][u][t, L] == 0}, u, {t, 0, T}, {x, 0, L}, 
MaxStepSize -> 0.005, MaxSteps -> 10^6];
q := NIntegrate[( 
Evaluate[First[Derivative[1, 0][u][tp, x] /. sol]])^2, {x, 0, L},
Method -> "LocalAdaptive", MinRecursion -> 50, 
MaxRecursion -> 100];
data = Parallelize[Table[q, {tp, 25.8, T, 0.5}]];
ListLinePlot[data, PlotRange -> All]
ListLinePlot[Abs[Fourier[data]]]

enter image description here enter image description here

As an answer to my code I will get a periodic discrete time dependent function called "data" which I want to get a Discrete Fourier transform of it using just one period of it,but I think some thing is wrong with the way I do Fourier transform.here is my code:

a = 0.05; L = 15; T = 20 \[Pi]; hdc = 2.1;
sol = NDSolve[{a*D[u[t, x], t] == D[u[t, x], x, x] - Sin[u[t, x]], 
u[0, x] == 0, Derivative[0, 1][u][t, 0] == Tanh[t/0.01]*hdc, 
Derivative[0, 1][u][t, L] == 0}, u, {t, 0, T}, {x, 0, L}, 
MaxStepSize -> 0.005, MaxSteps -> 10^6];
q := NIntegrate[( 
Evaluate[First[Derivative[1, 0][u][tp, x] /. sol]])^2, {x, 0, L},
Method -> "LocalAdaptive", MinRecursion -> 50, 
MaxRecursion -> 100];
data = Parallelize[Table[q, {tp, 25.8, T, 0.5}]];
ListLinePlot[data, PlotRange -> All]
ListLinePlot[Abs[Fourier[data]]]

As an answer to my code I will get a periodic discrete time dependent function called "data" which I want to get a Discrete Fourier transform of it using just one period of it,but I think some thing is wrong with the way I do Fourier transform.here is my code:

a = 0.05; L = 15; T = 20 \[Pi]; hdc = 2.1;
sol = NDSolve[{a*D[u[t, x], t] == D[u[t, x], x, x] - Sin[u[t, x]], 
u[0, x] == 0, Derivative[0, 1][u][t, 0] == Tanh[t/0.01]*hdc, 
Derivative[0, 1][u][t, L] == 0}, u, {t, 0, T}, {x, 0, L}, 
MaxStepSize -> 0.005, MaxSteps -> 10^6];
q := NIntegrate[( 
Evaluate[First[Derivative[1, 0][u][tp, x] /. sol]])^2, {x, 0, L},
Method -> "LocalAdaptive", MinRecursion -> 50, 
MaxRecursion -> 100];
data = Parallelize[Table[q, {tp, 25.8, T, 0.5}]];
ListLinePlot[data, PlotRange -> All]
ListLinePlot[Abs[Fourier[data]]]

enter image description here enter image description here

edited tags
Link
Post Migrated Here from stackoverflow.com (revisions)
Source Link
Loading