How to calculate Harmonic distortion

6 views (last 30 days)
Ricardo Rebelo
Ricardo Rebelo on 4 Dec 2020
Commented: Mathieu NOE on 8 Dec 2020
Good afternoon everyone.
I have measurements made of acceleration and other variables on three axes coming from a sensor (accelerometer and gyroscope).
I do data acquisition through LabView and I will do the data processing with MatLab.
I'm saving the files in .txt, and now I want to open that file and process the data.
I want to do the harmonic distortion, and find the specific harmonic. I've seen some codes about harmonic distortion but they all use functions to build the wave, but I have data from my measurements. I don't know if I managed to explain myself correctly.
Thank you.
  3 Comments
Ricardo Rebelo
Ricardo Rebelo on 4 Dec 2020
the scrip is the simple demo ?
I need to add to the simple demo script, the thd function:
%% Calcs
% THD with 5 harmonics including fundamental
nharm = 5;
Total_Distortion = thd(data,Fs,nharm);
Total_Distortion;
% THD factor in percent
Total_Distortion_Factor = 100*10^(Total_Distortion/20);
?
Thank´s a lot
Best regards
Mathieu NOE
Mathieu NOE on 8 Dec 2020
hello
yes , simly use the THD demo code above within my code - or separately, as you prefer

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!