Python Forum
Harmonics and their Magnitude values
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Harmonics and their Magnitude values
#1
Hello,
I am new to python, my problem is to find the harmonics values of the given signal after applying FFT(Fast fourier Transform) and their corresponding amplitude values.
I am able to find fundamental frequency and its magnitude value, but am not able to find next harmonics values and their magnitude values.
Let's Think F is the Fundamental Frequency , 2F, 3F, 4F are their harmonics values but am not getting logic behind to find their corresponding magnitude values in python and how to display harmonics values on the graph.


Thanks in advance.
Reply
#2
Hello and welcome to the forum.
We are always glad to help and guide you in the righty direction, but we need to see what have you tried. Please, post your code in python tags, full traceback in error tags (if you get any errors) and ask specific questions.
See BBcode help for more info.
Please, also mread What to include in a post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
This is the code for FFT of a give signal x, the fundamental frequency is getting correct but am not able to find next harmonics values and their corresponding amplitude values.


nfft = len(x)
nfft2 = 2**nextpow2(nfft)
ff = fft(x, nfft2)
fff = (ff[: nfft2/2])
#xfft = np.ndarray Fs*[: (nfft2/2-1)/nfft2]
xf = np.linspace(0.0, 1.0/(2.0*T), nfft2/2)
plt.plot(xf, abs(fff))
plt.show()
idx = np.argmax(np.abs(fff))
print('Fundamental frequency :',  xf[idx])
Reply
#4
Is this helpful? https://bl.ocks.org/fasiha/957035272009e...936a6af2eb
Reply
#5
Thanks for the reply..
I want to find next 6 harmonics values and their corresponding magnitude values..
The link which was given , I referred previously but i didn't get..

Thanks in advance.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Understand order of magnitude performance gap between python and C++ ThelannOryat 4 2,741 Mar-17-2021, 03:39 PM
Last Post: ThelannOryat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020