Figuring out the frequency components using FFTPlotting Fourier spectrum versus frequency of a signalWhat's the correct way to shift zero frequency to the center of a Fourier Transform?What do the X and Y axis stand for in the Fourier transform domain?Identifying the three frequencies using fourier transformPlotting the frequency spectrum of a data series using FourierFinding the discrete Fourier transform for a simple oscillator?How to deal with highly oscillatory integrand when using “NIntegrate” and have a precise resultDetecting beat frequency using FFTIdentifying the three frequencies using fourier transform
Is it really necessary to have 4 hours meeting in Sprint planning?
Can Northern Ireland's border issue be solved by repartition?
Hiking with a mule or two?
How could artificial intelligence harm us?
C# vector library
To this riddle, I invite
What did the controller say during my approach to land (audio clip)?
Are actors contractually obligated to certain things like going nude/ Sensual Scenes/ Gory Scenes?
Which museums have artworks of all four ninja turtles' namesakes?
Apple Developer Program Refund Help
Hilbert's hotel, why can't I repeat it infinitely many times?
Can someone explain to me the parameters of a lognormal distribution?
Applications of mathematics in clinical setting
Why are some of the Stunts in The Expanse RPG labelled 'Core'?
Centrifugal force with Newton's third law?
How to deal with my team leader who keeps calling me about project updates even though I am on leave for personal reasons?
Cheap antenna for new HF HAM
Norwegian refuses EU delay (4.7 hours) compensation because it turned out there was nothing wrong with the aircraft
Can multiple wall timers turn lights on or off when required?
Did Apollo carry and use WD40?
GitHub repo with Apache License version 2 in package.json, but no full license copy nor comment headers
Did HaShem ever command a Navi (Prophet) to break a law?
How is the problem, G has no triangle in Logspace?
Should the pagination be reset when changing the order?
Figuring out the frequency components using FFT
Plotting Fourier spectrum versus frequency of a signalWhat's the correct way to shift zero frequency to the center of a Fourier Transform?What do the X and Y axis stand for in the Fourier transform domain?Identifying the three frequencies using fourier transformPlotting the frequency spectrum of a data series using FourierFinding the discrete Fourier transform for a simple oscillator?How to deal with highly oscillatory integrand when using “NIntegrate” and have a precise resultDetecting beat frequency using FFTIdentifying the three frequencies using fourier transform
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
The function defined below has three frequencies 2, 4 and 10. How to use the Fourier transform (FFT) to show these frequencies?
myfun[t_] =
1/(2 Sqrt[
2]) ([Sqrt]Abs[
3 + Cos[4 t] -
4 Cos[2 t] (-1 +
E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2) +
4 E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2])
Edit: The suggested duplicate deals with a simple function. It really doesn't work for this complicated scenario. Would appreciate if someone gets it done.
fourier-analysis
$endgroup$
|
show 6 more comments
$begingroup$
The function defined below has three frequencies 2, 4 and 10. How to use the Fourier transform (FFT) to show these frequencies?
myfun[t_] =
1/(2 Sqrt[
2]) ([Sqrt]Abs[
3 + Cos[4 t] -
4 Cos[2 t] (-1 +
E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2) +
4 E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2])
Edit: The suggested duplicate deals with a simple function. It really doesn't work for this complicated scenario. Would appreciate if someone gets it done.
fourier-analysis
$endgroup$
$begingroup$
No, it has more than 3 frequencies due to the present of the factorE^(-0.018
t)` and the square roots.
$endgroup$
– Henrik Schumacher
8 hours ago
$begingroup$
Thanks,@HenrikSchumacher. Could this be shown using FFT?
$endgroup$
– Patrick
8 hours ago
1
$begingroup$
Possible duplicate of Identifying the three frequencies using fourier transform
$endgroup$
– ciao
8 hours ago
1
$begingroup$
Try this one or this one or...
$endgroup$
– march
8 hours ago
1
$begingroup$
@Patrick. Note that your frequencies will not be 2, 4, and 10 as you think. First of all, since theSin[10 t]
is squared, the relevant angular frequency is actually 20. Second of all, those are particular angular frequencies that show up. Instead, you should see dominant peaks at $2/2pi$, $4/2pi$, and $20/2pi$, which you will see if you use one of the linked answers. The one usingPeriodogram' is easy to use, and the other one shows the best way to use
Fourier` (the FFT) to get a power spectrum.
$endgroup$
– march
7 hours ago
|
show 6 more comments
$begingroup$
The function defined below has three frequencies 2, 4 and 10. How to use the Fourier transform (FFT) to show these frequencies?
myfun[t_] =
1/(2 Sqrt[
2]) ([Sqrt]Abs[
3 + Cos[4 t] -
4 Cos[2 t] (-1 +
E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2) +
4 E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2])
Edit: The suggested duplicate deals with a simple function. It really doesn't work for this complicated scenario. Would appreciate if someone gets it done.
fourier-analysis
$endgroup$
The function defined below has three frequencies 2, 4 and 10. How to use the Fourier transform (FFT) to show these frequencies?
myfun[t_] =
1/(2 Sqrt[
2]) ([Sqrt]Abs[
3 + Cos[4 t] -
4 Cos[2 t] (-1 +
E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2) +
4 E^(-0.018` t) (Cos[9.99999594999918` t] +
0.0009000003645002213` Sin[9.99999594999918` t])^2])
Edit: The suggested duplicate deals with a simple function. It really doesn't work for this complicated scenario. Would appreciate if someone gets it done.
fourier-analysis
fourier-analysis
edited 8 hours ago
Patrick
asked 8 hours ago
PatrickPatrick
112 bronze badges
112 bronze badges
$begingroup$
No, it has more than 3 frequencies due to the present of the factorE^(-0.018
t)` and the square roots.
$endgroup$
– Henrik Schumacher
8 hours ago
$begingroup$
Thanks,@HenrikSchumacher. Could this be shown using FFT?
$endgroup$
– Patrick
8 hours ago
1
$begingroup$
Possible duplicate of Identifying the three frequencies using fourier transform
$endgroup$
– ciao
8 hours ago
1
$begingroup$
Try this one or this one or...
$endgroup$
– march
8 hours ago
1
$begingroup$
@Patrick. Note that your frequencies will not be 2, 4, and 10 as you think. First of all, since theSin[10 t]
is squared, the relevant angular frequency is actually 20. Second of all, those are particular angular frequencies that show up. Instead, you should see dominant peaks at $2/2pi$, $4/2pi$, and $20/2pi$, which you will see if you use one of the linked answers. The one usingPeriodogram' is easy to use, and the other one shows the best way to use
Fourier` (the FFT) to get a power spectrum.
$endgroup$
– march
7 hours ago
|
show 6 more comments
$begingroup$
No, it has more than 3 frequencies due to the present of the factorE^(-0.018
t)` and the square roots.
$endgroup$
– Henrik Schumacher
8 hours ago
$begingroup$
Thanks,@HenrikSchumacher. Could this be shown using FFT?
$endgroup$
– Patrick
8 hours ago
1
$begingroup$
Possible duplicate of Identifying the three frequencies using fourier transform
$endgroup$
– ciao
8 hours ago
1
$begingroup$
Try this one or this one or...
$endgroup$
– march
8 hours ago
1
$begingroup$
@Patrick. Note that your frequencies will not be 2, 4, and 10 as you think. First of all, since theSin[10 t]
is squared, the relevant angular frequency is actually 20. Second of all, those are particular angular frequencies that show up. Instead, you should see dominant peaks at $2/2pi$, $4/2pi$, and $20/2pi$, which you will see if you use one of the linked answers. The one usingPeriodogram' is easy to use, and the other one shows the best way to use
Fourier` (the FFT) to get a power spectrum.
$endgroup$
– march
7 hours ago
$begingroup$
No, it has more than 3 frequencies due to the present of the factor
E^(-0.018
t)` and the square roots.$endgroup$
– Henrik Schumacher
8 hours ago
$begingroup$
No, it has more than 3 frequencies due to the present of the factor
E^(-0.018
t)` and the square roots.$endgroup$
– Henrik Schumacher
8 hours ago
$begingroup$
Thanks,@HenrikSchumacher. Could this be shown using FFT?
$endgroup$
– Patrick
8 hours ago
$begingroup$
Thanks,@HenrikSchumacher. Could this be shown using FFT?
$endgroup$
– Patrick
8 hours ago
1
1
$begingroup$
Possible duplicate of Identifying the three frequencies using fourier transform
$endgroup$
– ciao
8 hours ago
$begingroup$
Possible duplicate of Identifying the three frequencies using fourier transform
$endgroup$
– ciao
8 hours ago
1
1
$begingroup$
Try this one or this one or...
$endgroup$
– march
8 hours ago
$begingroup$
Try this one or this one or...
$endgroup$
– march
8 hours ago
1
1
$begingroup$
@Patrick. Note that your frequencies will not be 2, 4, and 10 as you think. First of all, since the
Sin[10 t]
is squared, the relevant angular frequency is actually 20. Second of all, those are particular angular frequencies that show up. Instead, you should see dominant peaks at $2/2pi$, $4/2pi$, and $20/2pi$, which you will see if you use one of the linked answers. The one using Periodogram' is easy to use, and the other one shows the best way to use
Fourier` (the FFT) to get a power spectrum.$endgroup$
– march
7 hours ago
$begingroup$
@Patrick. Note that your frequencies will not be 2, 4, and 10 as you think. First of all, since the
Sin[10 t]
is squared, the relevant angular frequency is actually 20. Second of all, those are particular angular frequencies that show up. Instead, you should see dominant peaks at $2/2pi$, $4/2pi$, and $20/2pi$, which you will see if you use one of the linked answers. The one using Periodogram' is easy to use, and the other one shows the best way to use
Fourier` (the FFT) to get a power spectrum.$endgroup$
– march
7 hours ago
|
show 6 more comments
2 Answers
2
active
oldest
votes
$begingroup$
First lets plot your function to see what it looks like.
Plot[myfun[t], t, 0, 100]
This is only between 0 to 100 seconds. What we see is some very high frequencies but also a constant frequency which we can estimate at about 0.3 Hz. If we plot at later times
Plot[myfun[t], t, 500, 600]
We can see that the starting high frequencies have died away and the frequency at about 0.3 Hz remains.
Now we can do a Fourier analysis. As you have some high frequencies we need to sample at a very fast sample rate. I have guessed at the sample rate but hope it is good enough.
sr = 100; (* Sample rate *)
data = Table[myfun[t], t, 0, 1000, 1/sr];
nn = Length@data
Plotting again shows that I seem to have captured the high frequency data
ListLinePlot[data[[1 ;; Round[100 sr]]]]
You should probably check by looking at a shorter time interval.
Now for the Fourier analysis.
ft = Fourier[data, FourierParameters -> -1, -1];
freqs = Table[f, f, 0, sr (nn - 1)/nn, sr/nn];
The second line of code is to make the frequencies that correspond to the data in the Fourier transform. See here for details.
ListLogPlot[Transpose[freqs, Abs[ft]][[1 ;; 10000]],
PlotRange -> All, Joined -> True]
We can see a dominant peak at about 0.3 Hz and lots of other peaks that make up your high frequencies.
Hope that helps.
$endgroup$
add a comment
|
$begingroup$
Periodogram and Spectrogram are also useful:
data = Table[myfun[t], t, 0, 100000, .1];
Periodogram[data, SampleRate -> 10, PlotRange -> All, Frame -> True,
FrameLabel -> "Hz", "dB"]
Spectrogram[data, SampleRate -> 10, PlotRange -> 0, .5,
FrameLabel -> "Time", "Hz"]
$endgroup$
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f206452%2ffiguring-out-the-frequency-components-using-fft%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
First lets plot your function to see what it looks like.
Plot[myfun[t], t, 0, 100]
This is only between 0 to 100 seconds. What we see is some very high frequencies but also a constant frequency which we can estimate at about 0.3 Hz. If we plot at later times
Plot[myfun[t], t, 500, 600]
We can see that the starting high frequencies have died away and the frequency at about 0.3 Hz remains.
Now we can do a Fourier analysis. As you have some high frequencies we need to sample at a very fast sample rate. I have guessed at the sample rate but hope it is good enough.
sr = 100; (* Sample rate *)
data = Table[myfun[t], t, 0, 1000, 1/sr];
nn = Length@data
Plotting again shows that I seem to have captured the high frequency data
ListLinePlot[data[[1 ;; Round[100 sr]]]]
You should probably check by looking at a shorter time interval.
Now for the Fourier analysis.
ft = Fourier[data, FourierParameters -> -1, -1];
freqs = Table[f, f, 0, sr (nn - 1)/nn, sr/nn];
The second line of code is to make the frequencies that correspond to the data in the Fourier transform. See here for details.
ListLogPlot[Transpose[freqs, Abs[ft]][[1 ;; 10000]],
PlotRange -> All, Joined -> True]
We can see a dominant peak at about 0.3 Hz and lots of other peaks that make up your high frequencies.
Hope that helps.
$endgroup$
add a comment
|
$begingroup$
First lets plot your function to see what it looks like.
Plot[myfun[t], t, 0, 100]
This is only between 0 to 100 seconds. What we see is some very high frequencies but also a constant frequency which we can estimate at about 0.3 Hz. If we plot at later times
Plot[myfun[t], t, 500, 600]
We can see that the starting high frequencies have died away and the frequency at about 0.3 Hz remains.
Now we can do a Fourier analysis. As you have some high frequencies we need to sample at a very fast sample rate. I have guessed at the sample rate but hope it is good enough.
sr = 100; (* Sample rate *)
data = Table[myfun[t], t, 0, 1000, 1/sr];
nn = Length@data
Plotting again shows that I seem to have captured the high frequency data
ListLinePlot[data[[1 ;; Round[100 sr]]]]
You should probably check by looking at a shorter time interval.
Now for the Fourier analysis.
ft = Fourier[data, FourierParameters -> -1, -1];
freqs = Table[f, f, 0, sr (nn - 1)/nn, sr/nn];
The second line of code is to make the frequencies that correspond to the data in the Fourier transform. See here for details.
ListLogPlot[Transpose[freqs, Abs[ft]][[1 ;; 10000]],
PlotRange -> All, Joined -> True]
We can see a dominant peak at about 0.3 Hz and lots of other peaks that make up your high frequencies.
Hope that helps.
$endgroup$
add a comment
|
$begingroup$
First lets plot your function to see what it looks like.
Plot[myfun[t], t, 0, 100]
This is only between 0 to 100 seconds. What we see is some very high frequencies but also a constant frequency which we can estimate at about 0.3 Hz. If we plot at later times
Plot[myfun[t], t, 500, 600]
We can see that the starting high frequencies have died away and the frequency at about 0.3 Hz remains.
Now we can do a Fourier analysis. As you have some high frequencies we need to sample at a very fast sample rate. I have guessed at the sample rate but hope it is good enough.
sr = 100; (* Sample rate *)
data = Table[myfun[t], t, 0, 1000, 1/sr];
nn = Length@data
Plotting again shows that I seem to have captured the high frequency data
ListLinePlot[data[[1 ;; Round[100 sr]]]]
You should probably check by looking at a shorter time interval.
Now for the Fourier analysis.
ft = Fourier[data, FourierParameters -> -1, -1];
freqs = Table[f, f, 0, sr (nn - 1)/nn, sr/nn];
The second line of code is to make the frequencies that correspond to the data in the Fourier transform. See here for details.
ListLogPlot[Transpose[freqs, Abs[ft]][[1 ;; 10000]],
PlotRange -> All, Joined -> True]
We can see a dominant peak at about 0.3 Hz and lots of other peaks that make up your high frequencies.
Hope that helps.
$endgroup$
First lets plot your function to see what it looks like.
Plot[myfun[t], t, 0, 100]
This is only between 0 to 100 seconds. What we see is some very high frequencies but also a constant frequency which we can estimate at about 0.3 Hz. If we plot at later times
Plot[myfun[t], t, 500, 600]
We can see that the starting high frequencies have died away and the frequency at about 0.3 Hz remains.
Now we can do a Fourier analysis. As you have some high frequencies we need to sample at a very fast sample rate. I have guessed at the sample rate but hope it is good enough.
sr = 100; (* Sample rate *)
data = Table[myfun[t], t, 0, 1000, 1/sr];
nn = Length@data
Plotting again shows that I seem to have captured the high frequency data
ListLinePlot[data[[1 ;; Round[100 sr]]]]
You should probably check by looking at a shorter time interval.
Now for the Fourier analysis.
ft = Fourier[data, FourierParameters -> -1, -1];
freqs = Table[f, f, 0, sr (nn - 1)/nn, sr/nn];
The second line of code is to make the frequencies that correspond to the data in the Fourier transform. See here for details.
ListLogPlot[Transpose[freqs, Abs[ft]][[1 ;; 10000]],
PlotRange -> All, Joined -> True]
We can see a dominant peak at about 0.3 Hz and lots of other peaks that make up your high frequencies.
Hope that helps.
edited 7 hours ago
answered 7 hours ago
HughHugh
7,4262 gold badges19 silver badges47 bronze badges
7,4262 gold badges19 silver badges47 bronze badges
add a comment
|
add a comment
|
$begingroup$
Periodogram and Spectrogram are also useful:
data = Table[myfun[t], t, 0, 100000, .1];
Periodogram[data, SampleRate -> 10, PlotRange -> All, Frame -> True,
FrameLabel -> "Hz", "dB"]
Spectrogram[data, SampleRate -> 10, PlotRange -> 0, .5,
FrameLabel -> "Time", "Hz"]
$endgroup$
add a comment
|
$begingroup$
Periodogram and Spectrogram are also useful:
data = Table[myfun[t], t, 0, 100000, .1];
Periodogram[data, SampleRate -> 10, PlotRange -> All, Frame -> True,
FrameLabel -> "Hz", "dB"]
Spectrogram[data, SampleRate -> 10, PlotRange -> 0, .5,
FrameLabel -> "Time", "Hz"]
$endgroup$
add a comment
|
$begingroup$
Periodogram and Spectrogram are also useful:
data = Table[myfun[t], t, 0, 100000, .1];
Periodogram[data, SampleRate -> 10, PlotRange -> All, Frame -> True,
FrameLabel -> "Hz", "dB"]
Spectrogram[data, SampleRate -> 10, PlotRange -> 0, .5,
FrameLabel -> "Time", "Hz"]
$endgroup$
Periodogram and Spectrogram are also useful:
data = Table[myfun[t], t, 0, 100000, .1];
Periodogram[data, SampleRate -> 10, PlotRange -> All, Frame -> True,
FrameLabel -> "Hz", "dB"]
Spectrogram[data, SampleRate -> 10, PlotRange -> 0, .5,
FrameLabel -> "Time", "Hz"]
answered 3 hours ago
David KeithDavid Keith
2,2851 gold badge5 silver badges17 bronze badges
2,2851 gold badge5 silver badges17 bronze badges
add a comment
|
add a comment
|
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f206452%2ffiguring-out-the-frequency-components-using-fft%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
No, it has more than 3 frequencies due to the present of the factor
E^(-0.018
t)` and the square roots.$endgroup$
– Henrik Schumacher
8 hours ago
$begingroup$
Thanks,@HenrikSchumacher. Could this be shown using FFT?
$endgroup$
– Patrick
8 hours ago
1
$begingroup$
Possible duplicate of Identifying the three frequencies using fourier transform
$endgroup$
– ciao
8 hours ago
1
$begingroup$
Try this one or this one or...
$endgroup$
– march
8 hours ago
1
$begingroup$
@Patrick. Note that your frequencies will not be 2, 4, and 10 as you think. First of all, since the
Sin[10 t]
is squared, the relevant angular frequency is actually 20. Second of all, those are particular angular frequencies that show up. Instead, you should see dominant peaks at $2/2pi$, $4/2pi$, and $20/2pi$, which you will see if you use one of the linked answers. The one usingPeriodogram' is easy to use, and the other one shows the best way to use
Fourier` (the FFT) to get a power spectrum.$endgroup$
– march
7 hours ago