Considering the cuts in the sin signal.
Plz help me to make a matlap code to find the
(Total Harmonic Distortion )
I have named “alpha” between them so i can cod any similar signal.
the matlap cod should plot the distortion found.
and calculate it Plz ❤️.
Below is the matlab code to compute the total harmonic distortion in a given signal. The below example uses a consine signal at 10 Hz fundamental freq and adds up two thermal harmonic distortions at 20 and 30 Hz with ampl. = 0.5.
Pl. replace your signal to get the THD of your signal.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
close all,
clear all,
clc,
Fs = 1000;
FundamentalFreq = 10;
Amp = 1;
t=0:(1/Fs):1;
%Pure Cosine Signal at Fundamental Freq = 10 Hz.
Signal = Amp*cos(2*pi*FundamentalFreq*t);
subplot(2,1,1); plot(Signal); title('Original Cosine Signal at
Fundamental Freq = 10 Hz');
%Add Harmonics at 20 and 30 Hz with Amp = 0.5;
Signal =
Amp*cos(2*pi*FundamentalFreq*t)+0.5*cos(2*pi*20*t)+0.5*cos(2*pi*30*t);
subplot(2,1,2); plot(Signal); title('Original Signal with THD at 20
Hz and 30 Hz');
r = THD(Signal)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Considering the cuts in the sin signal. Plz help me to make a matlap code to find the (Total Harmonic Distortion ) I have named “alpha” between them so i can cod any similar signal. the matlap cod...