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
How do I clean sealant/silicon from a glass mirror?
Hiking with a mule or two?
How is underwater propagation of sound possible?
Why there so many pitch control surfaces on the Piaggio P180 Avanti?
How could artificial intelligence harm us?
How to influence manager to not schedule team meetings during lunch?
Where Does VDD+0.3V Input Limit Come From on IC chips?
Was there a trial by combat between a man and a dog in medieval France?
Would Taiwan and China's dispute be solved if Taiwan gave up being the Republic of China?
Do things made of adamantine rust?
Is there an in-universe reason Harry says this or is this simply a Rowling mistake?
Asking an expert in your field that you have never met to review your manuscript
What is the need of methods like GET and POST in the HTTP protocol?
Resolving moral conflict
What was the deeper meaning of Hermione wanting the cloak?
How to make interviewee comfortable interviewing in lounge chairs
As a discovery writer, how do I complete an unfinished novel (which has highly diverged from the original plot ) after a time-gap?
Aligning two sets of equations with alignat?
When does removing Goblin Warchief affect its cost reduction ability?
Do liquid propellant rocket engines experience thrust oscillation?
How do I extract code from an arduino?
To this riddle, I invite
CDG baggage claim before or after immigration?
Is there any actual security benefit to restricting foreign IPs?
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