MATLAB
MATLAB
BACHELOR OF TECHNOLOGY
in
Electrical Engineering
By
ABHISHEK KUMAR
Under Supervision of
CERTIFICATE
This is to certify that the “Internship Report” submitted by ABHISHEK KUMAR
(Reg. No.-21103108028) is work done by him and submitted during 2023-24
academic year, in partial fulfilment of the requirements for the award of
the degree of BACHELOR OF TECHNOLOGY in ELECTRICAL ENGINEERING
Assistant Professor , EE
Prof. KN RAM
First I would like to thank UDEMY & AICTE for giving me the opportunity to
do an internship within the organisation.
I would also like to thanks all the people who worked along with me and helped
me in the learning of MATLAB SIMULATION at Udemy in learning and
working Environment.
It is indeed with a great sense of pleasure and immense sense of gratitude that I
acknowledge the help of these individuals and Faculty members.
I am highly indebted to Principal Dr. Om Prakash Roy, for the facilities provided
to accomplish this internship.
I would like to thank my Head of the Department Prof. KN Ram Sir for his
constructive criticism throughout my internship.
I am extremely great full to my department staff members and friends who helped
me in successful completion of this internship.
ABHISHEK KUMAR
(21103108028)
Introduction:
Objective of Internship
Upon successful completion of this Internship, the student should be able to:
Course Content
Introduction to MATLAB
Working with Matrices
Expressions
Relational and Logical Operations
Complex and Statistical Functions
Input / Output of Variables
Plotting Function
Flow Control
MATLAB Simulink Basic
Applications of MATLAB in Power Electronics and Machine Drive
Applications of MATLAB in Power and Control System
1
Experiment :
Study of Single Phase Half Wave Controlled Rectifier with R and RL Load
Objective: To Study the simulation of Single Phase Half Wave Controlled Rectifier with R and
RL Load using Simulink.
Software Needed: Matlab R2013a.
Circuit Diagram:
R and RL load
Theory: Single-phase half wave controlled rectifier means that the single SCR is used to convert
the ac to dc. During the positive half cycle of the input voltage, thyristor T1 is forward biased
and current flows through the load when the thyristor is fired, at ԝt=α. The thyristor conducts
only when the anode is positive with respect to cathode and a positive gate signal is applied,
otherwise, it remains in the forward blocking state and blocks the flow of the load current. In the
negative half cycle, i.e., at wt =π, the thyristor is in the reverse biased condition and no current
flows through the load. Thus, varying the firing angle at which the thyristor starts conducting in
positive half controls the average dc output voltage cycle. The waveforms of the above circuit
are shown in fig the output load voltage and current is positive, i.e., they are one quadrant; it is
called a half –wave semi converter.
Procedure:
2
Experimental Matlab
ab Model and Wavforms
Wavforms:
Single Phase Half Wave Controlled Rectifier R load model and waveform for α=30:
α=30
3
Single Phase Half Wave Controlled Rectifier R
Rl load model and waveform for α=30:
α=30
Result: Simulation of Single Phase Half Wave Controlled Rectifier with R and RL load is done
successfully and the theoretical and practical results are verified.
4
Experiment :
Study of Single Phase semi converter with R and RL Load
Objective: To Study the simulation of Single Phase semi converter with R and RL Load using
Simulink.
Software Needed: Matlab R2013a.
Circuit Diagram:
R and RL load
Theory: In this configuration two thyristors are replaced by power diodes and can be connected
in either arm of the bridge. Depending on the connections, these are further classified as
1. Symmetrical
2. Asymmetrical
Symmetrical configuration is in two types
1. Common cathode
2. Common anode
Out of these configurations, the common cathode symmetrical configuration is the most
commonly used configuration, because a single trigger can be used to fire both thyristors without
any electrically isolation. During the positive half cycle, when thyristor T1 is triggered, the load
currents flows through T1 and the diode D2 in the circuit shown in figure. During the negative
half –cycle, the thyristor T2 and the diode D1 constitute the load current.
5
Experimental Mat lab Model and Waveforms
Waveforms:
Single Phase Half Wave Controlled Rectifier R load model and waveform for α=30:
α=30
6
Single Phase Half Wave Controlled Rectifier R
Rl load model and waveform for α=30:
α=30
7
Experiment :
Study of Single Phase Bridge Controlled Rectifier with R and RL load
Objective: To Study the simulation of Single Phase Bridge Controlled Rectifier with R and RL
Load using Simulink.
Circuit Diagram:
R and RL load
Theory: A single-phase fully controlled bridge circuit consists of four thyristor as shown in
figure, with a resistive load. During the positive half cycle thyristors T1and T2 are in the
forward blocking state and when these thyristors fire simultaneously at wt =α , the load is
connected to the input through T1 and T2. During negative half cycle i.e., after wt =π , thyristor
T3 and T4 are in the forward blocking state, and simultaneous firing of these thyristors reverse
biases the previously conducting thyristors T1 and T2. These reverse biased thyristors turn off
due to line or natural commutation and the load current transfers from T1and T2 to T3 and T4.
Procedure:
8
Experimental Mat lab Model and Waveforms
Waveforms:
Single Phase Bridge Controlled Rectifier R load model and waveform for α=30:
α=30
9
Single Phase Bridge Controlled Rectifier R
RL load model and waveform for α=30:
α=30
10
Result: Simulation of Single Phase Bridge Controlled Rectifier with R and RL load is done
successfully and the theoretical and practical results are verified.
11
Experiment :
Study of Three Phase Semi-Converter with R and RL load
Objective: To Study the simulation of Three Phase Semi-Converter with R and RL Load using
Simulink.
Circuit Diagram:
R and RL load
Theory: The circuit of three phase semi-converter consists of three SCRs and three diodes. The
circuit diagram of three phase semi converter is shown in Figure. The output load voltage Vo
across the load terminals is controlled by varying the firing angles of SCRs T1, T2 and T3. The
diodes D1, D2 and D3 provide merely a return path for the current to the most negative line
terminal. For a firing angle delay of α=0 thyristors T1, T2, T3 would behave as diodes and the
output voltage of semi-converter would be symmetrical six pulse per cycle .The output voltage
consisting of pulses Vcb, Vab, Vac, Vbc. When the firing angle is delayed to α=15 SCRs T1, T2,
T3 is delayed but return diodes D1, D2, D3 remain unaffected so that only alternate pulses are
altered. The load current is continuous and has little ripple. The FD does not come into play for
α=15. Each SCR and diode conduct for 120 degree. Vcb is the load voltage from wt =0 to 60 .
As the first subscript indicates conducting element in the positive group, Vcb shows that T3 is
already conducting through diode B2 of negative group. Voltages Vab, Vac indicate that,
12
Experimental Mat lab Model and Waveforms
Waveforms:
Single Phase Bridge Controlled Rectifier R load model and waveform for α=15:
α=15
13
Single Phase Bridge Controlled Rectifier R
RL load model and waveform for α=15:
α=15
Result: Simulation of Three phase semi semi-converter with R and RL load is done successfully and
the theoretical and practical results are
14
Experiment :
Study of Three Phase Full Bridge Converter with R and RL load
Objective: To Study the simulation of Three Phase Full Bridge Converter with R and RL Load
using Simulink.
Circuit Diagram:
Theory: For any current to flow in the load at least one device from the top group (T1, T3, T5)
and one from the bottom group (T2, T4, T6) must conduct. It can be argued as in the case of an
uncontrolled converter only one device from these two groups will conduct. Then from
symmetry consideration it can be argued that each thyristor conducts for 120° of the input cycle.
Now the thyristors are fired in the sequence T1 → T2 → T3 → T4 → T5 → T6 → T1 with 60°
interval between each firing. Therefore thyristors on the same phase leg are fired at an interval of
180° and hence can not conduct simultaneously. This leaves only six possible conduction mode
for the converter in the continuous conduction mode of operation. These are T1T2, T2T3, T3T4,
15
16
Three Phase Bridge Controlled Rectifier R
Rl load model and waveform:
17
Experiment :
Study of Three Phase Inverter With 1800 Conduction Mode By Using Matlab
Programming
Objective: To analyze the matlab programming of Three Phase Inverter With 180 0 Conduction
mode
Circuit Diagram:
Theory:
In this mode of conduction, every device is in conduction state for 180° where they are switched
ON at 60° intervals. The terminals A, B and C are the output terminals of the bridge that are
connected to the three-phase delta or star connection of the load.
The operation of a balanced star connected load is explained in the diagram below. For the
period 0° − 60° the points S1, S5 and S6 are in conduction mode. The terminals A and C of the
load are connected to the source at its positive point. The terminal B is connected to the source
at its negative point. In addition, resistances R/2 is between the neutral and the positive end
while resistance R is between the neutral and the negative terminal.
18
title('vca')
grid
Result: Three Phase inverter with 1800 Conduction mode by using matlab programming done
successfully and output waveforms obtained.
19
Design of Operational Amplifier Simulator
Abstract
Operational amplifier (op-amp) is widely used in electronic engineering. Therefore their analysis and
synthesis must be thoroughly comprehended. The study, which was carried out .NET and MATLAB
based simulator, is designed for operational amplifier application circuit. Besides basic amplification
operations (phase inverting, phase non-inverting, buffer), the simulator can perform mathematical
operations (summing, subtraction, multiplication, division, differentiation, integration, exponentiation,
logarithm etc) and filtering operation. Due to the interactive interface of modules, simulator can also
be used for educational purposes, analysis and synthesis of op-amp circuits can be realized easily and
greater accuracy.
1. Introduction
Operational amplifiers (op-amps) have a very wide range of use which consists of the most
simple amplification operations, mathematical operations, filtering operations, analog-to-digital,
digital-to-analog conversion operations, and signal generators in industrial and scientific fields.
Therefore, main principles of such structures must be completely comprehended.
In the technical field, theoretical information must be used in practical applications for
reinforcing knowledge. But insufficient opportunities for laboratory experiments, absence of
application fields and complexity of the circuits make it difficult. For this reason, instead of
practical implementation, simulations on computers are preferred. In the literature many
simulator studies were performed on different topics in the field of electrical and electronics[1-3].
In this study, a simulator is designed for operational amplifiers. While interface of the simulator
is created using Visual Studio based on .NET [4], analysis are generated using MATLAB [5].
Basic applications of operational amplifiers (amplification, mathematical operations, filtering)
can be interactively performed with the simulator. So the effects of circuit parameters can be
simultaneously observed.
Operational amplifiers are differential amplifiers which have very high input and very low output
impedance (Table 1). They have also very high open loop gain. Operational amplifiers can be
used for different purposes with connecting appropriate components their terminals [6-8].
20
1040
In design stage of this simulator, two programming language was used. Main attributes of
operational amplifiers were established in MATLAB. After operational amplifiers basic methods
were written in MATLAB, due to creating interactive interface, the methods were placed in a
class named as “OpampClass” and using deploytool command, the class passed .dll file named
as opamp_lib.dll This file was attend references in the WPF project which was supplied by .NET.
The other .dll file named as MWArray.dll which has directory MATLAB was also joined WPF
project’s reference. In order to disposing “OpampClass” and Matlab data types, required
statements attend to the .NET project’s code. We used two data types in C# for invoking Matlab.
The first and widely used is MWNumericArray which holds matrix information and the second is
MWCharArray which holds string array used for selecting wave shape. The interactive part of
program was designed in .NET using events. For developing interactive interface, necessary
events were declared such as ValueChanged belongs to scrollbar’s event. Whole program was
built with following this programming technique.
Main window of designed simulator is shown in Fig. 1. The following operations can be
performed using these screen menus,
File: Creating new simulation, Opening a previously saved simulation, saving
simulation which was performed and printing operations.
Basic Circuits: Phase inverting, phase non-inverting, buffer, current to voltage – voltage
to current conversion operational amplifier applications.
Mathematical Circuits: Summing, subtraction, multiplication, division, multiplication
by a constant, differentiation, integration, logarithm, antilogarithm (exponentiation)
operational amplifier applications.
Filter Circuits: Low pass, high pass, band pass and band stop operational amplifier
applications.
Help: Information about program and operational amplifiers.
21
1041
3. Simulations
(1)
(a) Main screen of summing amplifier (b) Select voltage type, input amplitudes of voltages and
circuit’s parameters
22
1042
(2)
(a) Main screen of derivative amplifier (b) Select voltage type, input amplitude of voltage and
circuit’s parameters
As third simulation, the integration of unit step which has +1V amplitude is shown in Fig. 4.
(3)
(a) Main screen of integrator amplifier (b) Select voltage type, input amplitude of voltage and
circuit’s parameters
23
1043
As the last simulation, band pass filter application is given. Signal which comprises 200, 400,
600, 800 and 1000 Hz frequencies and conveys above 60 V amplitude for per frequency
component is supplied to input. According to input the 400 Hz signal component was passed the
filter effectively, the 200 Hz was passed partially and the other components were suppressed
efficiently [9]. The simulator results can be plotted both time domain and frequency domain.
(a) Main screen of band-pass filter simulation (b) Select frequencies and amplitudes of input voltage
and circuit’s parameters
24
1044
4. Conclusions
In the study which was carried out, a simulator for basic applications of operational amplifiers
was designed. The analysis and synthesis of operational amplifier circuits can be performed
effectively, efficiently and quickly with this program which can be easily used by people who
study or realizing projects in electric – electronic field. In future work, extending content of the
simulator and making the simulator accessible through network is aimed.
References
[1] Feisel L.D. and Rosa A.J. The role of laboratory in undergraduate engineering education.
Journal of Engineering Education 2005; 121-130.
[2] Balamuralithara B. and Woods P. C. Virtual laboratories in engineering education: The
simulation lab and remote lab. Computer Applications in Engineering Education 2009;
17:108-118.
[3] Sevgi L. Electrical and Computer Engineering Education in the 21st Century: Issues,
Perspectives and Challenges. Turk. J. Elec. Engin. 2006; 14 (1): 1-5.
[4] Microsoft Corporation (http://www.microsoft.com/visualstudio)
[5] MATLAB, The MathWorks, Inc.
[6] http://en.wikipedia.org/wiki/Operational_amplifier
[7] Nilsson J.W. Electric Circuits. Fourth ed. Addison-Wesley Publishing Company; 1993.
[8] Boylestad R. and Nashelsky L. Electronic Devices and Circuit Theory. 5th ed. Prentice Hall;
1992.
[9] Dorf R.C. and Svoboda J.A. Introduction to Electric Circuits. John Wiley & Sons; 2004.
25
Chapter 1
Tutorial lessons 1
1.1 Introduction
The tutorials are independent of the rest of the document. The primarily objective is to help
you learn quickly the first steps. The emphasis here is “learning by doing”. Therefore, the
best way to learn is by trying it yourself. Working through the examples will give you a feel
for the way that MATLAB operates. In this introduction we will describe how MATLAB
handles simple numerical expressions and mathematical formulas.
The name MATLAB stands for MATrix LABoratory. MATLAB was written originally
to provide easy access to matrix software developed by the LINPACK (linear system package)
and EISPACK (Eigen system package) projects.
MATLAB [1] is a high-performance language for technical computing. It integrates
computation, visualization, and programming environment. Furthermore, MATLAB is a
modern programming language environment: it has sophisticated data structures, contains
built-in editing and debugging tools, and supports object-oriented programming. These factors
make MATLAB an excellent tool for teaching and research.
MATLAB has many advantages compared to conventional computer languages (e.g.,
C, FORTRAN) for solving technical problems. MATLAB is an interactive system whose
basic data element is an array that does not require dimensioning. The software package
has been commercially available since 1984 and is now considered as a standard tool at most
universities and industries worldwide.
It has powerful built-in routines that enable a very wide variety of computations. It
also has easy to use graphics commands that make the visualization of results immediately
available. Specific applications are collected in packages referred to as toolbox. There are
toolboxes for signal processing, symbolic computation, control theory, simulation, optimiza-
tion, and several other fields of applied science and engineering.
In addition to the MATLAB documentation which is mostly available on-line, we would
26
recommend the following books: [2], [3], [4], [5], [6], [7], [8], and [9]. They are excellent in
their specific applications.
• How to log on
• Invoke MATLAB
• The Workspace
27
Figure 1.1: The graphical interface to the MATLAB workspace
28
Table 1.1: Basic arithmetic operators
Symbol Operation Example
+ Addition 2+3
− Subtraction 2−3
∗ Multiplication 2∗3
/ Division 2/3
For example,
>> x = expression
• manual entry
• built-in functions
• user-defined functions
29
Chapter 2
Tutorial lessons 2
12
30
2.4 Introduction
Matrices are the basic elements of the MATLAB environment. A matrix is a two-dimensional
array consisting of m rows and n columns. Special cases are column vectors (n = 1) and row
vectors (m = 1).
In this section we will illustrate how to apply different operations on matrices. The following
topics are discussed: vectors and matrices in MATLAB, the inverse of a matrix, determinants,
and matrix manipulation.
MATLAB supports two types of operations, known as matrix operations and array opera-
tions. Matrix operations will be discussed first.
>> v = [1 4 7 10 13]
v =
1 4 7 10 13
Column vectors are created in a similar way, however, semicolon (;) must separate the
components of a column vector,
>> w = [1;4;7;10;13]
w =
1
4
7
10
13
On the other hand, a row vector is converted to a column vector using the transpose operator.
The transpose operation is denoted by an apostrophe or a single quote (’).
19
31
>> w = v’
w =
1
4
7
10
13
Thus, v(1) is the first element of vector v, v(2) its second element, and so forth.
Furthermore, to access blocks of elements, we use MATLAB’s colon notation (:). For exam-
ple, to access the first three elements of v, we write,
>> v(1:3)
ans =
1 4 7
Or, all elements from the third through the last elements,
>> v(3,end)
ans =
7 10 13
where end signifies the last element in the vector. If v is a vector, writing
>> v(:)
>> v(1:end)
20
32
Here is a typical example. To enter a matrix A, such as,
1 2 3
A= 4 5 6 (2.1)
7 8 9
type,
>> A = [1 2 3; 4 5 6; 7 8 9]
A =
1 2 3
4 5 6
7 8 9
Note that the use of semicolons (;) here is different from their use mentioned earlier to
suppress output or to write multiple commands in a single line.
Once we have entered the matrix, it is automatically stored and remembered in the
Workspace. We can refer to it simply as matrix A. We can then view a particular element in
a matrix by specifying its location. We write,
>> A(2,1)
ans =
4
A(2,1) is an element located in the second row and first column. Its value is 4.
>> A(3,3) = 0
A =
1 2 3
4 5 6
7 8 0
21
33
Single elements of a matrix are accessed as A(i,j), where i ≥ 1 and j ≥ 1. Zero or negative
subscripts are not supported in MATLAB.
>> x = 0:0.1:5;
y = linspace(a,b)
generates a row vector y of 100 points linearly spaced between and including a and b.
y = linspace(a,b,n)
generates a row vector y of n points linearly spaced between and including a and b. This is
useful when we want to divide an interval into a number of subintervals of the same length.
For example,
divides the interval [0, 2π] into 100 equal subintervals, then creating a vector of 101 elements.
22
34
>> A(2,:)
ans =
4 5 6
>> A(:,2:3)
ans =
2 3
5 6
8 0
>> A(:,2)=[]
ans =
1 3
4 6
7 0
To interchange rows 1 and 2 of A, use the vector of row indices together with the colon
operator.
It is important to note that the colon operator (:) stands for all columns or all rows. To
create a vector version of matrix A, do the following
23
35
>> A(:)
ans =
1
2
3
4
5
6
7
8
0
The keyword end, used in A(end,:), denotes the last index in the specified dimension. Here
are some examples.
>> A
A =
1 2 3
4 5 6
7 8 9
>> A(2:3,2:3)
ans =
5 6
8 9
>> A(end:-1:1,end)
ans =
9
6
3
24
36
>> A([1 3],[2 3])
ans =
2 3
8 9
>> A(3,:) = []
A =
1 2 3
4 5 6
Third row of matrix A is now deleted. To restore the third row, we use a technique for
creating a matrix
2.5.9 Dimension
To determine the dimensions of a matrix or vector, use the command size. For example,
>> size(A)
ans =
3 3
>> [m,n]=size(A)
25
37
Chapter 3
30
38
.* Element-by-element multiplication
./ Element-by-element division
.^ Element-by-element exponentiation
>> C = A.*B
produces another matrix C of the same size with elements cij = aij bij . For example, using
the same 3 × 3 matrices,
1 2 3 10 20 30
A= 4 5 6 ,
B = 40 50 60
7 8 9 70 80 90
we have,
>> C = A.*B
C =
10 40 90
160 250 360
490 640 810
To raise a scalar to a power, we use for example the command 10^2. If we want the
operation to be applied to each element of a matrix, we use .^2. For example, if we want
to produce a new matrix whose elements are the square of the elements of the matrix A, we
enter
>> A.^2
ans =
1 4 9
16 25 36
49 64 81
The relations below summarize the above operations. To simplify, let’s consider two
vectors U and V with elements U = [ui ] and V = [vj ].
U. ∗ V produces [u1 v1 u2 v2 . . . un vn ]
U./V produces [u1 /v1 u2 /v2 . . . un /vn ]
U.ˆV produces [uv11 uv22 . . . uvnn ]
31
39
Operation Matrix Array
Addition + +
Subtraction − −
Multiplication ∗ .∗
Division / ./
Left division \ .\
Exponentiation ˆ .ˆ
Ax = b (3.2)
This equation can be solved for x using linear algebra. The result is x = A−1 b.
There are typically two ways to solve for x in MATLAB:
32
40
>> A = [1 2 3; 4 5 6; 7 8 0];
>> b = [1; 1; 1];
>> x = inv(A)*b
x =
-1.0000
1.0000
-0.0000
2. The second one is to use the backslash (\)operator. The numerical algorithm behind
this operator is computationally efficient. This is a numerically reliable way of solving
system of linear equations by using a well-known process of Gaussian elimination.
>> A = [1 2 3; 4 5 6; 7 8 0];
>> b = [1; 1; 1];
>> x = A\b
x =
-1.0000
1.0000
-0.0000
This problem is at the heart of many problems in scientific computation. Hence it is impor-
tant that we know how to solve this type of problem efficiently.
Now, we know how to solve a system of linear equations. In addition to this, we will
see some additional details which relate to this particular topic.
Calculating the inverse of A manually is probably not a pleasant work. Here the hand-
calculation of A−1 gives as a final result:
−16 8 −1
1
A−1 = 14 −7 2
9
−1 2 −1
33
41
>> A = [1 2 3; 4 5 6; 7 8 0];
>> inv(A)
ans =
-1.7778 0.8889 -0.1111
1.5556 -0.7778 0.2222
-0.1111 0.2222 -0.1111
>> det(A)
ans =
27
For further details on applied numerical linear algebra, see [10] and [11].
det Determinant
diag Diagonal matrices and diagonals of a matrix
eig Eigenvalues and eigenvectors
inv Matrix inverse
norm Matrix and vector norms
rank Number of linearly independent rows or columns
3.3 Exercises
Note: Due to the teaching class during this Fall Quarter 2005, the problems are temporarily
removed from this section.
34
42
Appendix A
Summary of commands
+ Addition
− Subtraction
∗ Multiplication (scalar and array)
/ Division (right)
ˆ Power or exponentiation
: Colon; creates vectors with equally spaced elements
; Semi-colon; suppresses display; ends row in array
, Comma; separates array subscripts
... Continuation of lines
% Percent; denotes a comment; specifies output format
0
Single quote; creates string; specifies matrix transpose
= Assignment operator
() Parentheses; encloses elements of arrays and input arguments
[] Brackets; encloses matrix elements and output arguments
53
43
Table A.2: Array operators
Character Description
.∗ Array multiplication
./ Array (right) division
.ˆ Array power
.\ Array (left) division
.0 Array (nonconjugated) transpose
54
44
Table A.4: Managing workspace and file commands
Command Description
55
45
Bibliography
[1] The MathWorks Inc. MATLAB 7.0 (R14SP2). The MathWorks Inc., 2005.
[5] D. J. Higham and N. J. Higham. MATLAB Guide. Siam, second edition edition, 2005.
[7] A. Gilat. MATLAB: An introduction with Applications. John Wiley and Sons, 2004.
[8] J. Cooper. A MATLAB Companion for Multivariable Calculus. Academic Press, 2001.
[9] J. C. Polking and D. Arnold. ODE using MATLAB. Prentice Hall, 2004.
[10] D. Kahaner, C. Moler, and S. Nash. Numerical Methods and Software. Prentice-Hall,
1989.
64
46