Harmonic Analysis (THD) of a Rectifier Using MATLAB and Plotly

Introduction: Harmonic Analysis (THD) of a Rectifier Using MATLAB and Plotly

AIM:   To compute the Total Harmonic Distortion (THD) generated by a rectifier feeding a Three phase RL load.

Personal computer with MATLAB software and Plotly.

NECESSITY OF SIMULATION : Simulation is the imitation of the operation of a real-world process or system over time. The act of simulating something first requires that a model be developed. 
Thus we can analyze the harmonic that will be generated by the rectifier and thus design the circuit. Thus the difficulty of implementation of hardware and analyzing is avoided. The best design obtained from simulation can then be used to develop the hardware.

Step 1: Theory

RECTIFIER : A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), which flows in only one direction. The process is known as rectification.

The three voltage sources are given to six pulse bridge rectifier. The AC is converted to DC signal by the rectifier. At the output side the RL load is connected. The harmonics produced by the rectifier is to be evaluated.


The total harmonic distortion, or THD, of a signal is a measurement of the harmonic distortion present and is defined as the ratio of the sum of the powers of all harmonic components to the power of the fundamental frequency.THD is a measurement of the extent of that distortion.
The THD is defined as the root mean square (RMS) value of the total harmonics of the signal, divide by the RMS value of its fundamental signal. 

The formula to calcuate THD is given below.
where Vi is the RMS voltage of ith harmonic and i = 1 is the fundamental frequency

Step 2: MATLAB Implementation

1) Open the MATLAB software.
2) Click on FIle -> New -> Model
This will open a model and the blocks can be added to the sheet.

3) With the help of Simulink library icon different blocks can be selected and placed on the sheet. The blocks are connected by the connecting arrow. 
4) The model is saved with '.m' extension.

Step 3: MATLAB Model

1) The final model is shown below. It is saved as 'threephase.m'. 
2) The parameters of each block is shown. The load is designed for:
Active Power = 40000 W
Frequency = 50 Hz
Inductive Reactive Power = 50.19 var

3) In each scope Save data to work space is given so that the data is available to be given to Plotly.
4) The model is Run by the arrow button.

Step 4: Scope Output

From the scope the waveform can be viewed.
1) Input Current waveform from Thee phase source
2) input pure sinusoidal input voltage
3) Rectified three phase Output voltage 

Step 5: Analysis of THD

Click on Power Gui block -> FFT Analysis

The total harmonic distortion will be calculated and displayed.

Result : 

Harmonics analysis for the given Rectifier feeding RL load is carried out using MATLAB.
              THD = 80.13 %

Step 6: Save the Values to Excel Sheet

1) In the main page of Matlab in the work space the scope data are available.
2) Get the data from scope.
3) Save it to Excel sheet.

Step 7: Starting With Plotly

plotly is an online collaborative data analysis and graphing tool. It can be accessed by the link given below.


Wit the help of plotly I have represented the result obtained from Matlab in which way I can analyze more efficiently.

 Sign in and Create an account

1) Import data to your account with help of import tab. 
2) click on the file name and it will be opened. You can view the imported data.

Step 8: Make a Plot

1) Open one excel sheet and click on Make a plot -> Line plot
2) Chose the x and y axis
3) The plot will be available

Step 9: To Make Plot With Two Y Axis

1) Click on Traces and select new axis/ subplot
2)Select New Y axis -> Right
3) import the second file and select x and y axis. Insert to -> Tab 5 -> Plot
4) A graph with two Y axis is obtained. Thus both the Input current and voltage waveform is analyzed.

The difference with matlab and plotly I found in plotly that when you move the pointer the data of the volatge and current at that instant of time is available.
It was very useful for analysis.

Step 10: To Make Subplot Stacked Vertically

1) To create graph on same axis then select subplot -> stacked

Step 11: THD

1) The data of THD is imported. The x and y axis is selected and data is represented in Bar graph.
2) A Fit linear plot is also used to represent.

Step 12: Final Plot With Plotly

Final output plot :

I have represented the Input waveform in different ways. Both stacked vertically and Two Y axis.
The rectified output is displayed. Thd value is also displayed.
With help of Plotly more Information can be displayed. :)

Hope this was helpful. Do vote for me for the contest if you found it helpful.

Data Visualization Contest

Third Prize in the
Data Visualization Contest

Scientific Method Contest

Participated in the
Scientific Method Contest

Full Spectrum Laser Contest

Participated in the
Full Spectrum Laser Contest

Be the First to Share


    • Puzzles Speed Challenge

      Puzzles Speed Challenge
    • "Can't Touch This" Family Contest

      "Can't Touch This" Family Contest
    • CNC Contest 2020

      CNC Contest 2020

    3 Discussions


    8 months ago

    How do you connect the block in the model circuit to get the value of the?


    5 years ago on Introduction

    Please help me out the library components used in it.!its really urgent for my designing because i couldnot find the components in dat used


    5 years ago on Introduction

    this is Great . it helped me :)

    but,for displayed THD = 80.13 % . what is the THDv or THDi ????

    and how about parameter for diode ???

    best Regards , thank :)