SlideShare a Scribd company logo
Page | 1
Akshit Jain Enrollment Number- TEN2103001
LAB FILE
of
Modeling and Simulation using MATLAB-Simulink
(EEE665)
Electrical Engineering Department
Faculty of Engineering, TMU
Jan 2024-May 2024
Submitted To: Submitted By: Akshit Jain
Mr. Umesh Kumar Singh (TEN2103001)
(Assistant Professor)
Page | 2
Akshit Jain Enrollment Number- TEN2103001
INDEX
S.No. Name of Experiment Page
No.
Remarks Signature
1. Study of Introduction to MATLAB. 3
2. Single phase uncontrolled converter for R and RL
load with capacitor filter using MATLAB/SIMULINK.
6
3. Single Phase Fully Controlled Converter Using R and
RL Load Using MATLAB/SIMULINK.
9
4. Three Phase Fully Controlled Converter Using R and
RL Load Using MATLAB/SIMULINK.
12
5. Single Phase uncontrolled inverter using
MATLAB/SIMULINK.
15
6. Three Phase-Controlled Inverters by PWM
Technique Using MATLAB/SIMULINK.
16
7. Single phase AC voltage controller using
MATLAB/SIMULINK.
19
8. Study of Basic Matrix Operations Using
MATLAB/SIMULINK.
27
9. Determination of Eigen Values and Eigen Vectors of
a Square Matrix Using MATLAB Software.
30
10. To Solve Linear Equation Using MATLAB Software. 32
11. Determination of Roots of a Polynomial Using
MATLAB.
33
12. Solution of Difference Equations using MATLAB
Software
34
Page | 3
Akshit Jain Enrollment Number- TEN2103001
 Starting MATLAB
Experiment: 01
Study of Introduction to MATLAB
After logging into our account, we can enter MATLAB by double-clicking on the MATLAB shortcut
icon (MATLAB 7.0.4) on your Windows desktop. When we start MATLAB, a special window called
the MATLAB desktop appears. The desktop is a window that contains other windows. The major
tools within or accessible from the desktop are:
•The Command Window
•The Command History
•The Workspace
•The Current Directory
•The Help Browser
•The Start button
1. Using MATLAB as a calculator: -
We will have noticed that if we do not specify an output variable, MATLAB uses a default variable
ans, short for answer, to store the results of the current calculation. Note that the variable ans is
created (or overwritten, if it is already existed). To avoid this, we may assign a value to a variable or
output argument name. For example:
X=12+1*2
X = 14
2. Creating simple plots: -
We need to prepare x and y in an identical array form; namely, x and y are row or column arrays of
the same length
The MATLAB command to plot a graph is plot (x, y).
>> x = [1 2 3 4 5 6];
>> y = [3 -1 2 4 5 1];
>> plot (x, y)
Page | 4
By- Akshit Jain Enrol.no. – TEN2103001
3. Matrix generation: -
A vector is a special case of a matrix. The purpose of this section is to show how to create
vectors and matrices in MATLAB. As discussed earlier, an array of dimension 1 ×n is called
a row vector, whereas an array of dimension m × 1 is called a column vector. The elements
of vectors in MATLAB are enclosed by square brackets and are separated by spaces or by
commas.
3.1Entering matrix:-
To enter a matrix c c =
1 2 3
4 5 6
7 8 9
3.2Matrix functions: -
>> d
d =
1.0e+16 *
-0.4504 0.9007 -0.4504
0.9007 -1.8014 0.9007
-0.4504 0.9007 -0.4504
>> e
e =
Page | 5
By- Akshit Jain Enrol.no. – TEN2103001
6.6613e-16
>> f
f =
1
5
9
>> g
g =
16.1168
-1.1168
-0.0000
>> h
h =
1.0e+16 *
-0.4504 0.9007 -0.4504
0.9007 -1.8014 0.9007
-0.4504 0.9007 -0.4504
>> i
i =
16.8481
>> j
j =
2
Introduction to programming in MATLAB
Commands with MATLAB is:
to create a file with a list of commands,
1. save the file, and
2. run the file.
Page | 6
By- Akshit Jain Enrol.no. – TEN2103001
Experiment-02
Single phase uncontrolled converter for R and RL load with capacitor filter using
MATLAB/SIMULINK.
A diode rectifier or uncontrolled rectifier is the converter circuit that converts ac signal into (an
alternating signal) dc signal (unidirectional signal). Uncontrolled rectifier circuits use diodes to
convert ac power to dc power and are divided into two types, single-phase and three-phase.
Again singe-phase uncontrolled rectifiers are divided into two types, they are,
1. Half-wave uncontrolled rectifier
2. Full-wave uncontrolled rectifier
i. Center tapped rectifier
ii. Bridge rectifier
Single Phase Full Wave Bridge Rectifier with R-Load:
The below figure presents the circuit connection of a single-phase full-wave bridge rectifier loaded
with a resistive load. A full-wave bridge rectifier uses four diodes connected in a close-loop
configuration which converts alternating current into direct current. The ac input to the
uncontrolled full wave rectifier is given through a transformer.
Single Phase Full Wave Bridge Rectifier with R Load
When the ac supply source to the rectifier is turned ON, the positive half cycle of ac input starts.
During the positive half cycle of ac input, point A in the above circuit is made positive with respect
to point B. Due to this, diodes D1 and D2 are forward biased (since their anode terminals are
connected to positive with respect to the cathode), and diodes D3 and D4 are reverse biased (since
their anode terminals are connected to negative with respect to the cathode).
Page | 7
By- Akshit Jain Enrol.no. – TEN2103001
Waveforms For Single Phase Full Wave Uncontrolled rectifier with R- Load
Thus, diodes D1 and D2 act as the closed switch and diodes D3 and D4 act as the open switch. Therefore, the
current starts flowing from point A, through diode D1, the load resistance R, and diode D2 to point B as shown
below in figure A. The load current will continue to flow through D1 and D2 until the positive half-cycle ends.
The average value of the load voltage Vdc can be calculated as follows,
Idc =2Vm/πR
The output dc power is given by,
Pdc = VdcIdc = 4Vm2/π2R
Single Phase Full Wave Bridge Rectifier with RL-Load:
In the above circuit, we have seen the full wave bridge rectifier with a resistive load where the output current and
voltage will be in phase. Let us see the circuit operation of an uncontrolled full wave bridge rectifier with RL-load.
The value of average output voltage and output current with RL
Page | 8
By- Akshit Jain Enrol.no. – TEN2103001
Single Phase Full Wave Bridge Rectifier with RL Load
Waveforms for Single Phase Full Wave Uncontrolled Rectifier With RL
Page | 9
By- Akshit Jain Enrol.no. – TEN2103001
Experiment- 03
Single Phase Fully Controlled converter using R and RL load using
MATLAB/SIMULINK
A single-phase bridge converter needs 4 thyristors. This configuration leads to two quadrant
operation. Such a converter is called the two-quadrant converter or fully controlled converter. Many
times, the bridge circuit is modified by replacing two thyristors by two diodes. This configuration
leads to one quadrant operation (operation is restricted to first quadrant). Such a converter is called
the one-quadrant converter or a semi converter.
The load on the converter may be purely resistive, inductive (R-L) load or R-L-E load. An R-L-E load
consists of resistance, inductance and motor (E stands for back emf of motor). The load may also
have a battery (emf E) instead of motor.
Single phase fully controlled rectifier using R Load
1. With Resistive Load: A fully controlled full-wave bridge rectifier is shown in Fig. All the four
devices used in the circuit are thyristors TH1-TH4 for control of output power. In this
circuit, diagonally opposite pair of thyristors are made to conduct, and are commutated,
simultaneously. During the first positive half cycle, thyristors TH1 and TH3 are forward
biased and if they are triggered simultaneously, the current flows through the load via
thyristor TH1-load-TH3-source. Thus, during positive half cycle, thyristors TH1 and TH3 are
conducting. During the negative half cycle of the ac input, thyristors TH2 and TH4 are
forward biased andif they are triggered simultaneously, the current flows through the load
via thyristor TH2- load-TH4-source. Thyristors TH1, TH3 and TH2, TH4 are triggered at the
same firing angle α in each positive and negative half cycles of the supply voltage
respectively. When the supply voltage falls to zero, the current also becomes zero. Thus,
thyristors TH1, TH3 in positive half cycle and TH2 and TH4 in negative half cycle turn off by
natural commutation.
Page | 10
By- Akshit Jain Enrol.no. – TEN2103001
Voltage and Current waveforms ofcircuit are Depicted
Single Phase Fully Controlled Rectifier With R-L Load
The voltage waveform at the dc terminals comprises a steady dc component superimposed with
an ac ripple component, having a fundamental frequency equal to twice that of ac supply.
Page | 11
By- Akshit Jain Enrol.no. – TEN2103001
Single Phase Fully Controlled Rectifier with RL Load
The average output dc voltage is given b
The average value of output dc voltage can be varied, by varying firing angle α, continuously from
positive maximum to negative maximum, assuming continuous current flow at the dc terminals.
Because the average dc voltage is reversible even though the current flow in the load is
unidirectional, the power flow in the convener can be in either direction.
Page | 12
By- Akshit Jain Enrol.no. – TEN2103001
Experiment-04
Three Phase Fully Controlled Converter Using R and RL Load
Using MATLAB/SIMULINK
A three-phase full-wave controlled rectifier, also known as a three-phase thyristor rectifier or six-
pulse rectifier, is a type of rectifier circuit used to convert alternating current (AC) into direct current
(DC). It utilizes six thyristors (also known as silicon-controlled rectifiers or SCR) to control the flow
of current. Here's how a three-phase controlled rectifier works:
1. Kirchhoff’s voltage law around any path shows that only one thyristor in the top half of the bridge
may conduct at one time (S1, S3, or S5). The thyristor that is conducting will have its anode connected
to the phase voltage that is highest at that instant.
2. Kirchhoff’s voltage law also shows that only one thyristor in the bottom half of the bridge may
conduct at one time (S2, S4, or S6). The thyristor that is conducting will have its cathodeconnected to
the phase voltage that is lowest at that instant.
3. As a consequence of points 1 and 2, S1 and S4 cannot conduct at the same time. Similarly,S3 and S6
cannot conduct simultaneously, nor can S5 and S2.
4. The output voltage across the load is one of the line-to-line voltages of the source. For example,
when S1 and S2 are on, the output voltage is Vac. Furthermore, the thyristors that are on are
determined by which line-to-line voltage is the highest at that instant. For example, when Vac is the
highest line-to-line voltage, the output is Vac.
Three Phase Full Wave Controlled Rectifier R Load
Single Phase AC Voltage Controller
Page | 13
By- Akshit Jain Enrol.no. – TEN2103001
Waveforms of Three Phase Full Wave SCR with R Load
One thyristor of the conducting pair powers the positive side of load, while the other thyristor
powers the negative side of the load. Thyristors T1, T3, T2, and T4 form a bridge rectifier network
between phases A and B, similary thyristors T3, T5, T4, and T6 between phases B and C and T5, T1, T6,
Three Phase Full Wave Controlled Rectifier - RL Load
Three Phase Full Wave SCR with RL Load
Page | 14
By- Akshit Jain Enrol.no. – TEN2103001
Waveforms of Three Phase Full Wave SCR with RL Load
Page | 15
By- Akshit Jain Enrol.no. – TEN2103001
Experiment-05
Single Phase uncontrolled inverter using MATLAB/SIMULINK
A single-phase voltage source inverter inverts the DC voltage into square-wave ac or sine-wave ac
voltages. Currently, there are two types of voltage inverters on the market: the first is a full-bridge
voltage source inverter, which consists of four switches, IGBTs, or MOSFETs, and the second is a
single-phase voltage source inverter, which consists of two switches, IGBTs, or MOSFETs. These
voltage source inverter applications include single phase UPS and switching power supplies. These
have been mostly used in high-power static power topologies.
Simulink Model of Single-Phase Voltage Source Inverter
In this article, we will explain how we can make a single-phase voltage source inverter as well as
how we choose the components with the help of the MATLAB Simulink model. First, we will explain
how we can make a new model in MATLAB. To make a new model, just open MATLAB and click on
the Simulink library. After clicking on Simulink Library, a new page will open with the name Simulink
Library Browser.
Simulink Model
Similarly, we search and drag all the other component blocks, such as the pulse generator, logic
gate, capacitor, resistor, etc. Then we join the circuit according to our requirements. Now our single-
p
h
a
s
evoltage source inverter is complete with the help of the MATLAB Simulink library. The Simulink
model circuit can be seen in the figure below.
Simulation
Because both IGBT switches should not be ON at the same time, one gate pulse directly connects
with one IGBT switch, and the other gate pulse is connecting with the other IGBT switch after NOT
Gate. In other words, this circuit works through complementary switching. When we simulate this
circuit at 50% duty cycle, then the output voltage would be half of the supply voltage, which means
it would be 50 volts, as shown in the figure below.
Page | 16
By- Akshit Jain Enrol.no. – TEN2103001
Experiment-06
Three Phase-Controlled Inverters by PWM Technique Using
MATLAB/SIMULINK
In electrical engineering, inverters are one of the basic circuits used and are mostly used in UPS
(uninterrupted power supply), which is present in almost every house now. Hence, the basic
purpose of an inverter is to convert direct current (DC) to alternating current (AC), which is no doubt
the opposite of rectifiers. So, for beginners, the definition of AC voltage can be taken as the voltage
that changes its direction from positive voltage to negative voltage across the same terminal in a
specified period of time over and over again. A simple sinusoidal wave is an AC wave. However, DC
can be defined as a constant source of voltage that remains either positive or negative over time.
Design Three Phase Inverter Using Simulink MATLAB
Open MATLAB and then open Simulink using the Simulink icon on MATLAB, as we have been doing
in previous tutorials. Create a new blank model and save it in the first hand so we can access it in
the future. Now, click on the library browser icon on Simulink’s recently created model. In the library
browser, select the section named “Simscape”, as shown in the figure below.
Three Phase Bridge
Place six such diodes on the model we created previously and arrange them in three rows with two
thyristors each. Connect all of them to make a bridge, as shown in the figure below.
Load and Source
At the input side of the bridge, we created previously, connect the DC voltage source, and at the
output, connect the load (change the RLC load to only a resistive load) with each branch to each row
as shown in the figure below.
Page | 17
By- Akshit Jain Enrol.no. – TEN2103001
As the phase delay is in seconds, the phase delay of the second pulse generator will be (2e-3)
*(1/6),and so on. All six pulse generators connected are shown in the figure below.
Page | 18
By- Akshit Jain Enrol.no. – TEN2103001
Simulink Model
At the output, connect the voltage measurement across each resistor and connect the scope at the
output of each voltmeter, as shown in the figure below.
Page | 19
By- Akshit Jain Enrol.no. – TEN2103001
Experiment 07
Single phase AC voltage controller using MATLAB/SIMULINK
The ac voltage controller also called as AC Regulator is a static power electronic circuit that converts
fixed ac to variable ac. It accomplishes this task without a change in frequency. It finds application
in heating, lighting circuits, speed control of ac machines, fan regulators, etc., similar to the
applications of an autotransformer.
The circuit of the ac voltage controller is based on either thyristor, TRIACs, SCRs, or IGBTs, which
gives a variable ac at the output when their triggering angle is adjusted or varied. The output voltage
is either increased, decreased, or kept constant by varying the RMS value of input fixed alternating
voltage.
Classification of AC Voltage Controllers:
Depending upon the supply, ac voltage controllers are divided into two types. They are,
 Single-phase ac voltage controller
 Half-wave voltage control or unidirectional ac voltage controller
 Full-wave control or bidirectional ac voltage controller
 Three-phase ac voltage controller
 Half-wave voltage control or unidirectional ac voltage controller
 Full-wave control or bidirectional ac voltage controller
Single Phase Half Wave AC Voltage Controller:
The below shows the single-phase half-wave or unidirectional ac voltage controller circuit
with output voltage and current waveforms.
Single-phase half-wave ac voltage controller consists of one thyristor in anti-parallel with one diode.
The power delivered to the load will depend upon the firing angle of the thyristor. During the
positive half cycle of supply voltage, only the thyristor is forward-biased. The thyristor will conduct
from α to π.
At ωt = π, the thyristor will get turn-off for R-load. Now, when the negative half cycle starts diode
will get forward biased (i.e., from π to 2π) and it conducts. Only the positive half cycle is controlled
in a single-phase half-wave ac voltage controller due to this reason it is also known as a
unidirectional ac voltage controller. The average value of the output voltage is given by,
Page | 20
By- Akshit Jain Enrol.no. – TEN2103001
Unidirectional ac voltage controllers are only suitable for low-power resistive loads like heating and
lighting.
Single Phase Full Wave AC Voltage Controller:
The full-wave or bidirectional ac voltage controller uses two thyristors instead of one thyristor and
diode. The two thyristors are connected in anti-parallel. Let see the working of full-wave ac voltage
controller with resistive (R) load and resistive-inductive (RL) load.
Single Phase Full Wave AC Voltage Controller with ResistiveLoad:
The power circuit diagram for a single-phase ac voltage controller with a resistive load is shown in
the below figure. The power delivered to the load flows through thyristor T1 during the positive half-
cycle and through thyristor T2 during the negative half-cycle.
Single Phase AC Voltage Controller Using Resistive Load
During the positive half cycle of the source voltage VS, SCR T1 is forward biased and SCR T2 is reverse
biased. No conduction of load current takes place until thyristor T1 is triggered at some firing angle
α. So, the entire supply voltage VS appears across thyristor T1 with the same polarity and across T2
with the reversed polarity. As soon as the thyristor T1 is triggered at the instant ωt = α, T1 starts
conducting and the entire supply voltage VS, except the drop across T1, appears across the load
resistance.
Page | 21
By- Akshit Jain Enrol.no. – TEN2103001
W
a
v
e
f
o
r
m
s
S
Single-phase AC Voltage Controller Using R- Load
The above shows the waveforms for source voltage, gating signals, output voltage, output current,
and the voltage across the SCRs. At ωt = π, the load voltage, the load current falls to zero and
therefore T1 stops conducting. Thereafter thyristor T2 will be forward biased and T1 will be
reversebiased and of course, there will be no conduction until T2 is triggered i.e., until (π + α).
Page | 22
By- Akshit Jain Enrol.no. – TEN2103001
As long as thyristor T1 in ON state, i.e., from α < ωt < π, voltage across T2 will be VT2 = – VT1 = -
(ON- state voltage drop of T1). At ωt = (π + α), thyristor T2 is triggered and it starts conducting.
Except for the small voltage drop across T2, the entire supply voltage appears across the load
resistance and the load current flows. As long as T2 is in ON state, i.e., from (π + α) < ωt < 2π,
voltage across T1 willbe VT1 = -VT2 = -(ON-state voltage drop of T2).
This process goes on and continues for every cycle as shown in the waveform. For resistance load,
the source current waveform will follow the source voltage waveform i.e., both the voltage and
current of the source will be in phase with each other.
If the firing angles at which the thyristors T1 and T2 are same. The RMS value of output voltage and
current with resistive load is given by,
Single Phase Full Wave AC Voltage Controller with RL Load
The below shows the single-phase ac voltage controller circuit with resistive and inductive load.
Page | 23
By- Akshit Jain Enrol.no. – TEN2103001
Single Phase AC Voltage Controller
Operation When α ≤ Φ:
Consider α = Φ (load phase angle) i.e., the ac voltage regulator is operating under steady-state
conditions. The conduction period of SCR T2 is from zero to Φ and from Φ to (π + Φ) SCR T1 will
conduct and again from (π + Φ) to (2π + Φ) SCR T2 will conduct as shown in the waveform below.
Waveforms for Single Phase AC Voltage ontrolled with RL Load
Page | 24
By- Akshit Jain Enrol.no. – TEN2103001
Waveforms for single phase AC Voltage controlled with RL Load
Thus, from Φ to (π + Φ), T1 will conduct. If T2 is triggered at a firing angle (π + α) < (π + Φ), then
T2 will remain OFF because T1 is conducting a current iT1 and the voltage drop across T1 will make
SCR T2 reverse bias. At ωt = (π + Φ), T2 will get turned ON since the voltage drop and conduction
current in T1 at this instant becomes zero. Thus, SCR T2 will conduct from (π + Φ) to (2π + Φ).
At the instant ωt = π, the load and source voltages become zero but, the current possesses some
value due to the presence of inductance at the load side. So, thyristor T1 continues to conduct
until the current flowing through it becomes zero. The angle at which thyristor current becomes
zero is known as extinction angle β. So, output voltage and current are equal to source voltage and
current from α to β respectively.
From angle β to (π + α), the value of load voltage and load current will be zero. At the instant ωt =
(π + α), thyristor T2 is triggered and it starts conducting. So, the load current which is the same as
current iT2 through T2 will flow in the reverse direction.
At the end of the first cycle i.e., at the instant ωt = 2π source voltage VS and load voltage
VO becomes zero but the current doesn’t become zero. At the instant ωt = (π + α + γ) where, ωt = γ
Page | 25
By- Akshit Jain Enrol.no. – TEN2103001
For High Inductance Value
It is known as conduction angle, the thyristor current iT2 becomes zero. This turns OFF thyristor
T2and it get reverse biased as shown in the waveform
.
Page | 26
By- Akshit Jain Enrol.no. – TEN2103001
The RMS value of output voltage and current with RL load is given by,
Page | 27
By- Akshit Jain Enrol.no. – TEN2103001
Experiment 08
Study of Basic Matrix Operations Using MATLAB/SIMULINK
The basic operations on Matrix are as follow:
Write a Matrix in MATLAB
A= [1 1 -2; 2 2 1; 2 1 1]
Find the size of a Matrix
The size of a Matrix is its number of rows and columns. To find the size of a Matrix, use the
following code
Size(A)
Add A and C using the following code
A+C
Divide Matrices element by element
To divide two Matrices element by element, use the following
A/C
Find the inverse of a Matrix
To find the inverse of a Matrix in MATLAB, use the following code
Inv(A)
Page | 28
By- Akshit Jain Enrol.no. – TEN2103001
1. Find the determinant of a Matrix
To find the determinant of a Matrix in MATLAB, use the following code
Det(A)
2. Define a Matrix with Random elements
To create a Matrix with Random element in Matlab, use
Rand (3,2)
3. Find the diagonal of a Matrix
To find the main diagonal of A, use
Diag(A)
4. Compute the Transpose of a Matrix
To find the transpose of a Matrix, use the following: -
Page | 29
By- Akshit Jain Enrol.no. – TEN2103001
Matrix Multiplication
Page | 30
By- Akshit Jain Enrol.no. – TEN2103001
Experiment 09
Determination of Eigen Values and Eigen Vectors of a Square Matrix Using MATLAB
Software
Eigen values and Eigen vectors are properties of a square matrix.
Let is an N*N matrix, X be a vector of size N*1 and be a scalar.
Then the values X, satisfying the equation are eigenvectors and eigenvalues of matrix A
respectively.
o A matrix of size N*N possess N eigenvalues
o Every eigenvalue corresponds to an eigenvector.
Matlab allows the users to find eigenvalues and eigenvectors of matrix using eig() method.
Different syntaxes of eig() method are:
o e = eig(A)
o [V,D] = eig(A)
o [V,D,W] = eig(A)
o e = eig(A,B)
Let
e = eig(A)
• It returns the vector of eigenvalues of square matrix A.
Page | 31
By- Akshit Jain Enrol.no. – TEN2103001
Output:
[V, D] = eig(A)
o It returns the diagonal matrix D having diagonals as eigenvalues.
o It also returns the matrix of right vectors as V.
o Normal eigenvectors are termed as right eigenvectors.
o V is a collection of N eigenvectors of each N*1 size (A is N*N size) that satisfies A*V
= V*D
% Square matrix of size 3*3
Output:
Page | 32
By- Akshit Jain Enrol.no. – TEN2103001
Experiment 10
To Solve Linear Equation Using MATLAB Software
We can use the MATLAB built-in function solve () to solve the system of linear equations in MATLAB.
First of all, we can define the variables using the syms variable. After that, we can write the
equations in MATLAB. After that, we need to use the function solve () to solve the equations. For
example, let’s define some equations in MATLAB and find their solution using the solve () function.
See the code below.
Output:
The function linsolve() is used instead of the solve() function if you have matrices instead of
equations. We can also convert the equations to matrix form using the equations To Matrix()
function. For example, let’s define some equations in Matlab and find their solution using the
linsolve() function. See the code below.
Page | 33
By- Akshit Jain Enrol.no. – TEN2103001
Experiment 11
Determination of Roots of a Polynomial Using MATLAB
Syntax r = roots(p) returns the roots of the polynomial represented by p as a column vector. Input
p is a vector containing n+1 polynomial coefficients, starting with the coefficient of xn
. For example,
p = [3 2 -2] represents the polynomial 3x2+2x−2. A coefficient of 0 indicates an intermediate power
that is not present in the equation.
The root’s function solves polynomial equations of the form p1xn+...+pnx+pn+1=0. Polynomial
equations contain a single variable with nonnegative exponents.
Examples
1. Roots of Quadratic Polynomial: -
 Use the poly function to obtain a polynomial from its roots: p = poly(r). The poly function
is the inverse of the roots function.
 Use the f zero function to find the roots of nonlinear equations. While the root’s function
works only with polynomials, the zero function is more broadly applicable to different
types of equations.
Roots of a Polynomial
Page | 34
By- Akshit Jain Enrol.no. – TEN2103001
Experiment 12
Solution of Difference Equations using MATLAB Software
First-Order Linear ODE
Solve this differential equation.
dy/dx=ty
Fiíst, represent y by using symsto create the symbolic function
y(t).symsy(t)
Define the equation using ==and represent diffeíentiation using the difffunction.
ode = diff (y, t) == t*y
ode(t) = diff(y(t), t) == t*y(t)
Solve the equation using dsolve.
ySol(t) = dsolve(ode)
ySol(t)= C1*exp(t^2/2)
Solve Differential Equation with Condition
In the previous solution, the constant C1appears because no condition was specified. Solve the
equation with the initial condition y(0) == 2. the dsolvefunction finds a value of C1that satisfies the
condition.
cond = y(0) == 2;
ySol(t) = dsolve(ode,cond)
ySol(t) =2*exp(t^2/2)
.
Nonlinear Differential Equation with Initial Condition: -Solve this nonlinear differential
equation with an initialcondition. the equation has multiple solutions.
Second-Oídeí ODE with Initial Conditions
Solve this second-order differential equation with two initial conditions.
Page | 35
By- Akshit Jain Enrol.no. – TEN2103001
d2
y/dx2
=cos(2x)-y
y (0)=1
y’
(0)=0
Steps: -Define the equation and conditions. The second initial condition involves the first derivative
of y. Represent the derivative by creating the symbolic function Dy = diff(y) and thendefine the
condition using Dy (0) ==0.
syms y(x)
Dy = diff(y);
ode = diff(y,x,2) == cos(2*x)-y;cond1
= y(0) == 1;
cond2 = Dy(0) == 0;
Solve odefor y. Simplify the solution using the simplifyfunction.
conds = [cond1 cond2]; ySol(x)
= dsolve(ode,conds);ySol =
simplify(ySol)
ySol(x) = 1 - (8*sin(x/2)^4)/3

More Related Content

Similar to The MATLAB File by Akshit Jain .pdf on .

Ekeeda - First Year Enginering - Basic Electrical Engineering
Ekeeda - First Year Enginering - Basic Electrical EngineeringEkeeda - First Year Enginering - Basic Electrical Engineering
Ekeeda - First Year Enginering - Basic Electrical Engineering
EkeedaPvtLtd
 
C04721623
C04721623C04721623
C04721623
IOSR-JEN
 
Three Phase Rectifier By Vivek Ahlawat
Three Phase Rectifier By Vivek AhlawatThree Phase Rectifier By Vivek Ahlawat
Three Phase Rectifier By Vivek Ahlawat
VIVEK AHLAWAT
 
Ee 791 drives lab maual
Ee 791 drives lab maualEe 791 drives lab maual
Ee 791 drives lab maual
Divya15121983
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
IJERD Editor
 
PED drivers t5656979089897877ghvvnvgcxxn
PED drivers t5656979089897877ghvvnvgcxxnPED drivers t5656979089897877ghvvnvgcxxn
PED drivers t5656979089897877ghvvnvgcxxn
nightbot15
 
POWER SUPPLY(Ashu).pptx
POWER SUPPLY(Ashu).pptxPOWER SUPPLY(Ashu).pptx
POWER SUPPLY(Ashu).pptx
Ashu Chaudhary
 
Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...
Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...
Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...
ijsrd.com
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
IJERD Editor
 
Transformer_theory.pptx
Transformer_theory.pptxTransformer_theory.pptx
Transformer_theory.pptx
Satish Pydimarla
 
Chapter02
Chapter02Chapter02
Chapter02
vikram anand
 
Experimental verification of network theorems, ugc practical physics s_paul
Experimental verification of network theorems, ugc practical physics s_paulExperimental verification of network theorems, ugc practical physics s_paul
Experimental verification of network theorems, ugc practical physics s_paul
spaul15
 
3. Half-Wave Rectifier_verstud.pdf
3. Half-Wave Rectifier_verstud.pdf3. Half-Wave Rectifier_verstud.pdf
3. Half-Wave Rectifier_verstud.pdf
LIEWHUIFANGUNIMAP
 
377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx
377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx
377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx
priyakunduq
 
L 29(nkd)(pe) ((ee)nptel)
L 29(nkd)(pe) ((ee)nptel) L 29(nkd)(pe) ((ee)nptel)
L 29(nkd)(pe) ((ee)nptel) Roopa Reddy
 
D03310019025
D03310019025D03310019025
D03310019025
theijes
 
Analysis and hardware implementation of five level cascaded H Bridge inverter
Analysis and hardware implementation of five level cascaded H Bridge inverterAnalysis and hardware implementation of five level cascaded H Bridge inverter
Analysis and hardware implementation of five level cascaded H Bridge inverter
IJERA Editor
 
Electrical transmission line
Electrical transmission lineElectrical transmission line
Electrical transmission line
Dhananjay Jha
 
ECE 505 Power electronics final paper
ECE 505 Power electronics final paperECE 505 Power electronics final paper
ECE 505 Power electronics final paperRob Garrone
 
Ms3621652169
Ms3621652169Ms3621652169
Ms3621652169
IJERA Editor
 

Similar to The MATLAB File by Akshit Jain .pdf on . (20)

Ekeeda - First Year Enginering - Basic Electrical Engineering
Ekeeda - First Year Enginering - Basic Electrical EngineeringEkeeda - First Year Enginering - Basic Electrical Engineering
Ekeeda - First Year Enginering - Basic Electrical Engineering
 
C04721623
C04721623C04721623
C04721623
 
Three Phase Rectifier By Vivek Ahlawat
Three Phase Rectifier By Vivek AhlawatThree Phase Rectifier By Vivek Ahlawat
Three Phase Rectifier By Vivek Ahlawat
 
Ee 791 drives lab maual
Ee 791 drives lab maualEe 791 drives lab maual
Ee 791 drives lab maual
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
PED drivers t5656979089897877ghvvnvgcxxn
PED drivers t5656979089897877ghvvnvgcxxnPED drivers t5656979089897877ghvvnvgcxxn
PED drivers t5656979089897877ghvvnvgcxxn
 
POWER SUPPLY(Ashu).pptx
POWER SUPPLY(Ashu).pptxPOWER SUPPLY(Ashu).pptx
POWER SUPPLY(Ashu).pptx
 
Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...
Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...
Analysis of Multilevel Inverter using Bipolar and Unipolar Switching Schemes ...
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
 
Transformer_theory.pptx
Transformer_theory.pptxTransformer_theory.pptx
Transformer_theory.pptx
 
Chapter02
Chapter02Chapter02
Chapter02
 
Experimental verification of network theorems, ugc practical physics s_paul
Experimental verification of network theorems, ugc practical physics s_paulExperimental verification of network theorems, ugc practical physics s_paul
Experimental verification of network theorems, ugc practical physics s_paul
 
3. Half-Wave Rectifier_verstud.pdf
3. Half-Wave Rectifier_verstud.pdf3. Half-Wave Rectifier_verstud.pdf
3. Half-Wave Rectifier_verstud.pdf
 
377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx
377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx
377275109-Ch-2-Uncontrolled-Rectifiers-Autosaved.pptx
 
L 29(nkd)(pe) ((ee)nptel)
L 29(nkd)(pe) ((ee)nptel) L 29(nkd)(pe) ((ee)nptel)
L 29(nkd)(pe) ((ee)nptel)
 
D03310019025
D03310019025D03310019025
D03310019025
 
Analysis and hardware implementation of five level cascaded H Bridge inverter
Analysis and hardware implementation of five level cascaded H Bridge inverterAnalysis and hardware implementation of five level cascaded H Bridge inverter
Analysis and hardware implementation of five level cascaded H Bridge inverter
 
Electrical transmission line
Electrical transmission lineElectrical transmission line
Electrical transmission line
 
ECE 505 Power electronics final paper
ECE 505 Power electronics final paperECE 505 Power electronics final paper
ECE 505 Power electronics final paper
 
Ms3621652169
Ms3621652169Ms3621652169
Ms3621652169
 

More from Akshit Jain

Time Management by Akshit Jain ctld .ppt
Time Management by Akshit Jain ctld .pptTime Management by Akshit Jain ctld .ppt
Time Management by Akshit Jain ctld .ppt
Akshit Jain
 
7. IPR.pptx By- Akshit Jain Human Values
7. IPR.pptx By- Akshit Jain Human Values7. IPR.pptx By- Akshit Jain Human Values
7. IPR.pptx By- Akshit Jain Human Values
Akshit Jain
 
8. Whistle Blowing.pptx By Akshit Jain .
8. Whistle Blowing.pptx By Akshit Jain   .8. Whistle Blowing.pptx By Akshit Jain   .
8. Whistle Blowing.pptx By Akshit Jain .
Akshit Jain
 
6. Sexual Misconduct.ppt by Akshit Jain .
6. Sexual Misconduct.ppt by Akshit Jain  .6. Sexual Misconduct.ppt by Akshit Jain  .
6. Sexual Misconduct.ppt by Akshit Jain .
Akshit Jain
 
Gender Issues.ppt download by Akshit Jain
Gender Issues.ppt download by Akshit JainGender Issues.ppt download by Akshit Jain
Gender Issues.ppt download by Akshit Jain
Akshit Jain
 
4.Happiness and Prosperity.ppt BY Akshit Jain
4.Happiness and Prosperity.ppt BY Akshit Jain4.Happiness and Prosperity.ppt BY Akshit Jain
4.Happiness and Prosperity.ppt BY Akshit Jain
Akshit Jain
 
3. Discrimination at work.pptx by Akshit Jain
3. Discrimination at work.pptx by Akshit Jain3. Discrimination at work.pptx by Akshit Jain
3. Discrimination at work.pptx by Akshit Jain
Akshit Jain
 
Ethical Issues at Workplace.ppt by Akshit Jain
Ethical Issues at Workplace.ppt by Akshit JainEthical Issues at Workplace.ppt by Akshit Jain
Ethical Issues at Workplace.ppt by Akshit Jain
Akshit Jain
 
1.Morals, Values and Ethics By Akshit Jain.ppt
1.Morals, Values and Ethics By Akshit Jain.ppt1.Morals, Values and Ethics By Akshit Jain.ppt
1.Morals, Values and Ethics By Akshit Jain.ppt
Akshit Jain
 
220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx
220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx
220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx
Akshit Jain
 
presentation on growth mindset vs fixed mindset by AKshit jain .pptx
presentation on growth mindset vs fixed mindset by AKshit jain .pptxpresentation on growth mindset vs fixed mindset by AKshit jain .pptx
presentation on growth mindset vs fixed mindset by AKshit jain .pptx
Akshit Jain
 
microprocessor .pptx
microprocessor .pptxmicroprocessor .pptx
microprocessor .pptx
Akshit Jain
 
220KV SUB STATION.pptx
220KV SUB STATION.pptx220KV SUB STATION.pptx
220KV SUB STATION.pptx
Akshit Jain
 

More from Akshit Jain (13)

Time Management by Akshit Jain ctld .ppt
Time Management by Akshit Jain ctld .pptTime Management by Akshit Jain ctld .ppt
Time Management by Akshit Jain ctld .ppt
 
7. IPR.pptx By- Akshit Jain Human Values
7. IPR.pptx By- Akshit Jain Human Values7. IPR.pptx By- Akshit Jain Human Values
7. IPR.pptx By- Akshit Jain Human Values
 
8. Whistle Blowing.pptx By Akshit Jain .
8. Whistle Blowing.pptx By Akshit Jain   .8. Whistle Blowing.pptx By Akshit Jain   .
8. Whistle Blowing.pptx By Akshit Jain .
 
6. Sexual Misconduct.ppt by Akshit Jain .
6. Sexual Misconduct.ppt by Akshit Jain  .6. Sexual Misconduct.ppt by Akshit Jain  .
6. Sexual Misconduct.ppt by Akshit Jain .
 
Gender Issues.ppt download by Akshit Jain
Gender Issues.ppt download by Akshit JainGender Issues.ppt download by Akshit Jain
Gender Issues.ppt download by Akshit Jain
 
4.Happiness and Prosperity.ppt BY Akshit Jain
4.Happiness and Prosperity.ppt BY Akshit Jain4.Happiness and Prosperity.ppt BY Akshit Jain
4.Happiness and Prosperity.ppt BY Akshit Jain
 
3. Discrimination at work.pptx by Akshit Jain
3. Discrimination at work.pptx by Akshit Jain3. Discrimination at work.pptx by Akshit Jain
3. Discrimination at work.pptx by Akshit Jain
 
Ethical Issues at Workplace.ppt by Akshit Jain
Ethical Issues at Workplace.ppt by Akshit JainEthical Issues at Workplace.ppt by Akshit Jain
Ethical Issues at Workplace.ppt by Akshit Jain
 
1.Morals, Values and Ethics By Akshit Jain.ppt
1.Morals, Values and Ethics By Akshit Jain.ppt1.Morals, Values and Ethics By Akshit Jain.ppt
1.Morals, Values and Ethics By Akshit Jain.ppt
 
220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx
220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx
220 kv Sub- Station By Akshit Jain Majhola Moradabad .docx
 
presentation on growth mindset vs fixed mindset by AKshit jain .pptx
presentation on growth mindset vs fixed mindset by AKshit jain .pptxpresentation on growth mindset vs fixed mindset by AKshit jain .pptx
presentation on growth mindset vs fixed mindset by AKshit jain .pptx
 
microprocessor .pptx
microprocessor .pptxmicroprocessor .pptx
microprocessor .pptx
 
220KV SUB STATION.pptx
220KV SUB STATION.pptx220KV SUB STATION.pptx
220KV SUB STATION.pptx
 

Recently uploaded

Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
Kamal Acharya
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answer
apareshmondalnita
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
NurvisNavarroSanchez
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
Kamal Acharya
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
wendy cai
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
jeevanprasad8
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
Kamal Acharya
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
VigneshvaranMech
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Antenna efficency lecture course chapter 3.pdf
Antenna  efficency lecture course chapter 3.pdfAntenna  efficency lecture course chapter 3.pdf
Antenna efficency lecture course chapter 3.pdf
AbrahamGadissa
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Introduction to Casting Processes in Manufacturing
Introduction to Casting Processes in ManufacturingIntroduction to Casting Processes in Manufacturing
Introduction to Casting Processes in Manufacturing
ssuser0811ec
 

Recently uploaded (20)

Online blood donation management system project.pdf
Online blood donation management system project.pdfOnline blood donation management system project.pdf
Online blood donation management system project.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
fluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answerfluid mechanics gate notes . gate all pyqs answer
fluid mechanics gate notes . gate all pyqs answer
 
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdfDanfoss NeoCharge Technology -A Revolution in 2024.pdf
Danfoss NeoCharge Technology -A Revolution in 2024.pdf
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
fundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projectionfundamentals of drawing and isometric and orthographic projection
fundamentals of drawing and isometric and orthographic projection
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Antenna efficency lecture course chapter 3.pdf
Antenna  efficency lecture course chapter 3.pdfAntenna  efficency lecture course chapter 3.pdf
Antenna efficency lecture course chapter 3.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Introduction to Casting Processes in Manufacturing
Introduction to Casting Processes in ManufacturingIntroduction to Casting Processes in Manufacturing
Introduction to Casting Processes in Manufacturing
 

The MATLAB File by Akshit Jain .pdf on .

  • 1. Page | 1 Akshit Jain Enrollment Number- TEN2103001 LAB FILE of Modeling and Simulation using MATLAB-Simulink (EEE665) Electrical Engineering Department Faculty of Engineering, TMU Jan 2024-May 2024 Submitted To: Submitted By: Akshit Jain Mr. Umesh Kumar Singh (TEN2103001) (Assistant Professor)
  • 2. Page | 2 Akshit Jain Enrollment Number- TEN2103001 INDEX S.No. Name of Experiment Page No. Remarks Signature 1. Study of Introduction to MATLAB. 3 2. Single phase uncontrolled converter for R and RL load with capacitor filter using MATLAB/SIMULINK. 6 3. Single Phase Fully Controlled Converter Using R and RL Load Using MATLAB/SIMULINK. 9 4. Three Phase Fully Controlled Converter Using R and RL Load Using MATLAB/SIMULINK. 12 5. Single Phase uncontrolled inverter using MATLAB/SIMULINK. 15 6. Three Phase-Controlled Inverters by PWM Technique Using MATLAB/SIMULINK. 16 7. Single phase AC voltage controller using MATLAB/SIMULINK. 19 8. Study of Basic Matrix Operations Using MATLAB/SIMULINK. 27 9. Determination of Eigen Values and Eigen Vectors of a Square Matrix Using MATLAB Software. 30 10. To Solve Linear Equation Using MATLAB Software. 32 11. Determination of Roots of a Polynomial Using MATLAB. 33 12. Solution of Difference Equations using MATLAB Software 34
  • 3. Page | 3 Akshit Jain Enrollment Number- TEN2103001  Starting MATLAB Experiment: 01 Study of Introduction to MATLAB After logging into our account, we can enter MATLAB by double-clicking on the MATLAB shortcut icon (MATLAB 7.0.4) on your Windows desktop. When we start MATLAB, a special window called the MATLAB desktop appears. The desktop is a window that contains other windows. The major tools within or accessible from the desktop are: •The Command Window •The Command History •The Workspace •The Current Directory •The Help Browser •The Start button 1. Using MATLAB as a calculator: - We will have noticed that if we do not specify an output variable, MATLAB uses a default variable ans, short for answer, to store the results of the current calculation. Note that the variable ans is created (or overwritten, if it is already existed). To avoid this, we may assign a value to a variable or output argument name. For example: X=12+1*2 X = 14 2. Creating simple plots: - We need to prepare x and y in an identical array form; namely, x and y are row or column arrays of the same length The MATLAB command to plot a graph is plot (x, y). >> x = [1 2 3 4 5 6]; >> y = [3 -1 2 4 5 1]; >> plot (x, y)
  • 4. Page | 4 By- Akshit Jain Enrol.no. – TEN2103001 3. Matrix generation: - A vector is a special case of a matrix. The purpose of this section is to show how to create vectors and matrices in MATLAB. As discussed earlier, an array of dimension 1 ×n is called a row vector, whereas an array of dimension m × 1 is called a column vector. The elements of vectors in MATLAB are enclosed by square brackets and are separated by spaces or by commas. 3.1Entering matrix:- To enter a matrix c c = 1 2 3 4 5 6 7 8 9 3.2Matrix functions: - >> d d = 1.0e+16 * -0.4504 0.9007 -0.4504 0.9007 -1.8014 0.9007 -0.4504 0.9007 -0.4504 >> e e =
  • 5. Page | 5 By- Akshit Jain Enrol.no. – TEN2103001 6.6613e-16 >> f f = 1 5 9 >> g g = 16.1168 -1.1168 -0.0000 >> h h = 1.0e+16 * -0.4504 0.9007 -0.4504 0.9007 -1.8014 0.9007 -0.4504 0.9007 -0.4504 >> i i = 16.8481 >> j j = 2 Introduction to programming in MATLAB Commands with MATLAB is: to create a file with a list of commands, 1. save the file, and 2. run the file.
  • 6. Page | 6 By- Akshit Jain Enrol.no. – TEN2103001 Experiment-02 Single phase uncontrolled converter for R and RL load with capacitor filter using MATLAB/SIMULINK. A diode rectifier or uncontrolled rectifier is the converter circuit that converts ac signal into (an alternating signal) dc signal (unidirectional signal). Uncontrolled rectifier circuits use diodes to convert ac power to dc power and are divided into two types, single-phase and three-phase. Again singe-phase uncontrolled rectifiers are divided into two types, they are, 1. Half-wave uncontrolled rectifier 2. Full-wave uncontrolled rectifier i. Center tapped rectifier ii. Bridge rectifier Single Phase Full Wave Bridge Rectifier with R-Load: The below figure presents the circuit connection of a single-phase full-wave bridge rectifier loaded with a resistive load. A full-wave bridge rectifier uses four diodes connected in a close-loop configuration which converts alternating current into direct current. The ac input to the uncontrolled full wave rectifier is given through a transformer. Single Phase Full Wave Bridge Rectifier with R Load When the ac supply source to the rectifier is turned ON, the positive half cycle of ac input starts. During the positive half cycle of ac input, point A in the above circuit is made positive with respect to point B. Due to this, diodes D1 and D2 are forward biased (since their anode terminals are connected to positive with respect to the cathode), and diodes D3 and D4 are reverse biased (since their anode terminals are connected to negative with respect to the cathode).
  • 7. Page | 7 By- Akshit Jain Enrol.no. – TEN2103001 Waveforms For Single Phase Full Wave Uncontrolled rectifier with R- Load Thus, diodes D1 and D2 act as the closed switch and diodes D3 and D4 act as the open switch. Therefore, the current starts flowing from point A, through diode D1, the load resistance R, and diode D2 to point B as shown below in figure A. The load current will continue to flow through D1 and D2 until the positive half-cycle ends. The average value of the load voltage Vdc can be calculated as follows, Idc =2Vm/πR The output dc power is given by, Pdc = VdcIdc = 4Vm2/π2R Single Phase Full Wave Bridge Rectifier with RL-Load: In the above circuit, we have seen the full wave bridge rectifier with a resistive load where the output current and voltage will be in phase. Let us see the circuit operation of an uncontrolled full wave bridge rectifier with RL-load. The value of average output voltage and output current with RL
  • 8. Page | 8 By- Akshit Jain Enrol.no. – TEN2103001 Single Phase Full Wave Bridge Rectifier with RL Load Waveforms for Single Phase Full Wave Uncontrolled Rectifier With RL
  • 9. Page | 9 By- Akshit Jain Enrol.no. – TEN2103001 Experiment- 03 Single Phase Fully Controlled converter using R and RL load using MATLAB/SIMULINK A single-phase bridge converter needs 4 thyristors. This configuration leads to two quadrant operation. Such a converter is called the two-quadrant converter or fully controlled converter. Many times, the bridge circuit is modified by replacing two thyristors by two diodes. This configuration leads to one quadrant operation (operation is restricted to first quadrant). Such a converter is called the one-quadrant converter or a semi converter. The load on the converter may be purely resistive, inductive (R-L) load or R-L-E load. An R-L-E load consists of resistance, inductance and motor (E stands for back emf of motor). The load may also have a battery (emf E) instead of motor. Single phase fully controlled rectifier using R Load 1. With Resistive Load: A fully controlled full-wave bridge rectifier is shown in Fig. All the four devices used in the circuit are thyristors TH1-TH4 for control of output power. In this circuit, diagonally opposite pair of thyristors are made to conduct, and are commutated, simultaneously. During the first positive half cycle, thyristors TH1 and TH3 are forward biased and if they are triggered simultaneously, the current flows through the load via thyristor TH1-load-TH3-source. Thus, during positive half cycle, thyristors TH1 and TH3 are conducting. During the negative half cycle of the ac input, thyristors TH2 and TH4 are forward biased andif they are triggered simultaneously, the current flows through the load via thyristor TH2- load-TH4-source. Thyristors TH1, TH3 and TH2, TH4 are triggered at the same firing angle α in each positive and negative half cycles of the supply voltage respectively. When the supply voltage falls to zero, the current also becomes zero. Thus, thyristors TH1, TH3 in positive half cycle and TH2 and TH4 in negative half cycle turn off by natural commutation.
  • 10. Page | 10 By- Akshit Jain Enrol.no. – TEN2103001 Voltage and Current waveforms ofcircuit are Depicted Single Phase Fully Controlled Rectifier With R-L Load The voltage waveform at the dc terminals comprises a steady dc component superimposed with an ac ripple component, having a fundamental frequency equal to twice that of ac supply.
  • 11. Page | 11 By- Akshit Jain Enrol.no. – TEN2103001 Single Phase Fully Controlled Rectifier with RL Load The average output dc voltage is given b The average value of output dc voltage can be varied, by varying firing angle α, continuously from positive maximum to negative maximum, assuming continuous current flow at the dc terminals. Because the average dc voltage is reversible even though the current flow in the load is unidirectional, the power flow in the convener can be in either direction.
  • 12. Page | 12 By- Akshit Jain Enrol.no. – TEN2103001 Experiment-04 Three Phase Fully Controlled Converter Using R and RL Load Using MATLAB/SIMULINK A three-phase full-wave controlled rectifier, also known as a three-phase thyristor rectifier or six- pulse rectifier, is a type of rectifier circuit used to convert alternating current (AC) into direct current (DC). It utilizes six thyristors (also known as silicon-controlled rectifiers or SCR) to control the flow of current. Here's how a three-phase controlled rectifier works: 1. Kirchhoff’s voltage law around any path shows that only one thyristor in the top half of the bridge may conduct at one time (S1, S3, or S5). The thyristor that is conducting will have its anode connected to the phase voltage that is highest at that instant. 2. Kirchhoff’s voltage law also shows that only one thyristor in the bottom half of the bridge may conduct at one time (S2, S4, or S6). The thyristor that is conducting will have its cathodeconnected to the phase voltage that is lowest at that instant. 3. As a consequence of points 1 and 2, S1 and S4 cannot conduct at the same time. Similarly,S3 and S6 cannot conduct simultaneously, nor can S5 and S2. 4. The output voltage across the load is one of the line-to-line voltages of the source. For example, when S1 and S2 are on, the output voltage is Vac. Furthermore, the thyristors that are on are determined by which line-to-line voltage is the highest at that instant. For example, when Vac is the highest line-to-line voltage, the output is Vac. Three Phase Full Wave Controlled Rectifier R Load Single Phase AC Voltage Controller
  • 13. Page | 13 By- Akshit Jain Enrol.no. – TEN2103001 Waveforms of Three Phase Full Wave SCR with R Load One thyristor of the conducting pair powers the positive side of load, while the other thyristor powers the negative side of the load. Thyristors T1, T3, T2, and T4 form a bridge rectifier network between phases A and B, similary thyristors T3, T5, T4, and T6 between phases B and C and T5, T1, T6, Three Phase Full Wave Controlled Rectifier - RL Load Three Phase Full Wave SCR with RL Load
  • 14. Page | 14 By- Akshit Jain Enrol.no. – TEN2103001 Waveforms of Three Phase Full Wave SCR with RL Load
  • 15. Page | 15 By- Akshit Jain Enrol.no. – TEN2103001 Experiment-05 Single Phase uncontrolled inverter using MATLAB/SIMULINK A single-phase voltage source inverter inverts the DC voltage into square-wave ac or sine-wave ac voltages. Currently, there are two types of voltage inverters on the market: the first is a full-bridge voltage source inverter, which consists of four switches, IGBTs, or MOSFETs, and the second is a single-phase voltage source inverter, which consists of two switches, IGBTs, or MOSFETs. These voltage source inverter applications include single phase UPS and switching power supplies. These have been mostly used in high-power static power topologies. Simulink Model of Single-Phase Voltage Source Inverter In this article, we will explain how we can make a single-phase voltage source inverter as well as how we choose the components with the help of the MATLAB Simulink model. First, we will explain how we can make a new model in MATLAB. To make a new model, just open MATLAB and click on the Simulink library. After clicking on Simulink Library, a new page will open with the name Simulink Library Browser. Simulink Model Similarly, we search and drag all the other component blocks, such as the pulse generator, logic gate, capacitor, resistor, etc. Then we join the circuit according to our requirements. Now our single- p h a s evoltage source inverter is complete with the help of the MATLAB Simulink library. The Simulink model circuit can be seen in the figure below. Simulation Because both IGBT switches should not be ON at the same time, one gate pulse directly connects with one IGBT switch, and the other gate pulse is connecting with the other IGBT switch after NOT Gate. In other words, this circuit works through complementary switching. When we simulate this circuit at 50% duty cycle, then the output voltage would be half of the supply voltage, which means it would be 50 volts, as shown in the figure below.
  • 16. Page | 16 By- Akshit Jain Enrol.no. – TEN2103001 Experiment-06 Three Phase-Controlled Inverters by PWM Technique Using MATLAB/SIMULINK In electrical engineering, inverters are one of the basic circuits used and are mostly used in UPS (uninterrupted power supply), which is present in almost every house now. Hence, the basic purpose of an inverter is to convert direct current (DC) to alternating current (AC), which is no doubt the opposite of rectifiers. So, for beginners, the definition of AC voltage can be taken as the voltage that changes its direction from positive voltage to negative voltage across the same terminal in a specified period of time over and over again. A simple sinusoidal wave is an AC wave. However, DC can be defined as a constant source of voltage that remains either positive or negative over time. Design Three Phase Inverter Using Simulink MATLAB Open MATLAB and then open Simulink using the Simulink icon on MATLAB, as we have been doing in previous tutorials. Create a new blank model and save it in the first hand so we can access it in the future. Now, click on the library browser icon on Simulink’s recently created model. In the library browser, select the section named “Simscape”, as shown in the figure below. Three Phase Bridge Place six such diodes on the model we created previously and arrange them in three rows with two thyristors each. Connect all of them to make a bridge, as shown in the figure below. Load and Source At the input side of the bridge, we created previously, connect the DC voltage source, and at the output, connect the load (change the RLC load to only a resistive load) with each branch to each row as shown in the figure below.
  • 17. Page | 17 By- Akshit Jain Enrol.no. – TEN2103001 As the phase delay is in seconds, the phase delay of the second pulse generator will be (2e-3) *(1/6),and so on. All six pulse generators connected are shown in the figure below.
  • 18. Page | 18 By- Akshit Jain Enrol.no. – TEN2103001 Simulink Model At the output, connect the voltage measurement across each resistor and connect the scope at the output of each voltmeter, as shown in the figure below.
  • 19. Page | 19 By- Akshit Jain Enrol.no. – TEN2103001 Experiment 07 Single phase AC voltage controller using MATLAB/SIMULINK The ac voltage controller also called as AC Regulator is a static power electronic circuit that converts fixed ac to variable ac. It accomplishes this task without a change in frequency. It finds application in heating, lighting circuits, speed control of ac machines, fan regulators, etc., similar to the applications of an autotransformer. The circuit of the ac voltage controller is based on either thyristor, TRIACs, SCRs, or IGBTs, which gives a variable ac at the output when their triggering angle is adjusted or varied. The output voltage is either increased, decreased, or kept constant by varying the RMS value of input fixed alternating voltage. Classification of AC Voltage Controllers: Depending upon the supply, ac voltage controllers are divided into two types. They are,  Single-phase ac voltage controller  Half-wave voltage control or unidirectional ac voltage controller  Full-wave control or bidirectional ac voltage controller  Three-phase ac voltage controller  Half-wave voltage control or unidirectional ac voltage controller  Full-wave control or bidirectional ac voltage controller Single Phase Half Wave AC Voltage Controller: The below shows the single-phase half-wave or unidirectional ac voltage controller circuit with output voltage and current waveforms. Single-phase half-wave ac voltage controller consists of one thyristor in anti-parallel with one diode. The power delivered to the load will depend upon the firing angle of the thyristor. During the positive half cycle of supply voltage, only the thyristor is forward-biased. The thyristor will conduct from α to π. At ωt = π, the thyristor will get turn-off for R-load. Now, when the negative half cycle starts diode will get forward biased (i.e., from π to 2π) and it conducts. Only the positive half cycle is controlled in a single-phase half-wave ac voltage controller due to this reason it is also known as a unidirectional ac voltage controller. The average value of the output voltage is given by,
  • 20. Page | 20 By- Akshit Jain Enrol.no. – TEN2103001 Unidirectional ac voltage controllers are only suitable for low-power resistive loads like heating and lighting. Single Phase Full Wave AC Voltage Controller: The full-wave or bidirectional ac voltage controller uses two thyristors instead of one thyristor and diode. The two thyristors are connected in anti-parallel. Let see the working of full-wave ac voltage controller with resistive (R) load and resistive-inductive (RL) load. Single Phase Full Wave AC Voltage Controller with ResistiveLoad: The power circuit diagram for a single-phase ac voltage controller with a resistive load is shown in the below figure. The power delivered to the load flows through thyristor T1 during the positive half- cycle and through thyristor T2 during the negative half-cycle. Single Phase AC Voltage Controller Using Resistive Load During the positive half cycle of the source voltage VS, SCR T1 is forward biased and SCR T2 is reverse biased. No conduction of load current takes place until thyristor T1 is triggered at some firing angle α. So, the entire supply voltage VS appears across thyristor T1 with the same polarity and across T2 with the reversed polarity. As soon as the thyristor T1 is triggered at the instant ωt = α, T1 starts conducting and the entire supply voltage VS, except the drop across T1, appears across the load resistance.
  • 21. Page | 21 By- Akshit Jain Enrol.no. – TEN2103001 W a v e f o r m s S Single-phase AC Voltage Controller Using R- Load The above shows the waveforms for source voltage, gating signals, output voltage, output current, and the voltage across the SCRs. At ωt = π, the load voltage, the load current falls to zero and therefore T1 stops conducting. Thereafter thyristor T2 will be forward biased and T1 will be reversebiased and of course, there will be no conduction until T2 is triggered i.e., until (π + α).
  • 22. Page | 22 By- Akshit Jain Enrol.no. – TEN2103001 As long as thyristor T1 in ON state, i.e., from α < ωt < π, voltage across T2 will be VT2 = – VT1 = - (ON- state voltage drop of T1). At ωt = (π + α), thyristor T2 is triggered and it starts conducting. Except for the small voltage drop across T2, the entire supply voltage appears across the load resistance and the load current flows. As long as T2 is in ON state, i.e., from (π + α) < ωt < 2π, voltage across T1 willbe VT1 = -VT2 = -(ON-state voltage drop of T2). This process goes on and continues for every cycle as shown in the waveform. For resistance load, the source current waveform will follow the source voltage waveform i.e., both the voltage and current of the source will be in phase with each other. If the firing angles at which the thyristors T1 and T2 are same. The RMS value of output voltage and current with resistive load is given by, Single Phase Full Wave AC Voltage Controller with RL Load The below shows the single-phase ac voltage controller circuit with resistive and inductive load.
  • 23. Page | 23 By- Akshit Jain Enrol.no. – TEN2103001 Single Phase AC Voltage Controller Operation When α ≤ Φ: Consider α = Φ (load phase angle) i.e., the ac voltage regulator is operating under steady-state conditions. The conduction period of SCR T2 is from zero to Φ and from Φ to (π + Φ) SCR T1 will conduct and again from (π + Φ) to (2π + Φ) SCR T2 will conduct as shown in the waveform below. Waveforms for Single Phase AC Voltage ontrolled with RL Load
  • 24. Page | 24 By- Akshit Jain Enrol.no. – TEN2103001 Waveforms for single phase AC Voltage controlled with RL Load Thus, from Φ to (π + Φ), T1 will conduct. If T2 is triggered at a firing angle (π + α) < (π + Φ), then T2 will remain OFF because T1 is conducting a current iT1 and the voltage drop across T1 will make SCR T2 reverse bias. At ωt = (π + Φ), T2 will get turned ON since the voltage drop and conduction current in T1 at this instant becomes zero. Thus, SCR T2 will conduct from (π + Φ) to (2π + Φ). At the instant ωt = π, the load and source voltages become zero but, the current possesses some value due to the presence of inductance at the load side. So, thyristor T1 continues to conduct until the current flowing through it becomes zero. The angle at which thyristor current becomes zero is known as extinction angle β. So, output voltage and current are equal to source voltage and current from α to β respectively. From angle β to (π + α), the value of load voltage and load current will be zero. At the instant ωt = (π + α), thyristor T2 is triggered and it starts conducting. So, the load current which is the same as current iT2 through T2 will flow in the reverse direction. At the end of the first cycle i.e., at the instant ωt = 2π source voltage VS and load voltage VO becomes zero but the current doesn’t become zero. At the instant ωt = (π + α + γ) where, ωt = γ
  • 25. Page | 25 By- Akshit Jain Enrol.no. – TEN2103001 For High Inductance Value It is known as conduction angle, the thyristor current iT2 becomes zero. This turns OFF thyristor T2and it get reverse biased as shown in the waveform .
  • 26. Page | 26 By- Akshit Jain Enrol.no. – TEN2103001 The RMS value of output voltage and current with RL load is given by,
  • 27. Page | 27 By- Akshit Jain Enrol.no. – TEN2103001 Experiment 08 Study of Basic Matrix Operations Using MATLAB/SIMULINK The basic operations on Matrix are as follow: Write a Matrix in MATLAB A= [1 1 -2; 2 2 1; 2 1 1] Find the size of a Matrix The size of a Matrix is its number of rows and columns. To find the size of a Matrix, use the following code Size(A) Add A and C using the following code A+C Divide Matrices element by element To divide two Matrices element by element, use the following A/C Find the inverse of a Matrix To find the inverse of a Matrix in MATLAB, use the following code Inv(A)
  • 28. Page | 28 By- Akshit Jain Enrol.no. – TEN2103001 1. Find the determinant of a Matrix To find the determinant of a Matrix in MATLAB, use the following code Det(A) 2. Define a Matrix with Random elements To create a Matrix with Random element in Matlab, use Rand (3,2) 3. Find the diagonal of a Matrix To find the main diagonal of A, use Diag(A) 4. Compute the Transpose of a Matrix To find the transpose of a Matrix, use the following: -
  • 29. Page | 29 By- Akshit Jain Enrol.no. – TEN2103001 Matrix Multiplication
  • 30. Page | 30 By- Akshit Jain Enrol.no. – TEN2103001 Experiment 09 Determination of Eigen Values and Eigen Vectors of a Square Matrix Using MATLAB Software Eigen values and Eigen vectors are properties of a square matrix. Let is an N*N matrix, X be a vector of size N*1 and be a scalar. Then the values X, satisfying the equation are eigenvectors and eigenvalues of matrix A respectively. o A matrix of size N*N possess N eigenvalues o Every eigenvalue corresponds to an eigenvector. Matlab allows the users to find eigenvalues and eigenvectors of matrix using eig() method. Different syntaxes of eig() method are: o e = eig(A) o [V,D] = eig(A) o [V,D,W] = eig(A) o e = eig(A,B) Let e = eig(A) • It returns the vector of eigenvalues of square matrix A.
  • 31. Page | 31 By- Akshit Jain Enrol.no. – TEN2103001 Output: [V, D] = eig(A) o It returns the diagonal matrix D having diagonals as eigenvalues. o It also returns the matrix of right vectors as V. o Normal eigenvectors are termed as right eigenvectors. o V is a collection of N eigenvectors of each N*1 size (A is N*N size) that satisfies A*V = V*D % Square matrix of size 3*3 Output:
  • 32. Page | 32 By- Akshit Jain Enrol.no. – TEN2103001 Experiment 10 To Solve Linear Equation Using MATLAB Software We can use the MATLAB built-in function solve () to solve the system of linear equations in MATLAB. First of all, we can define the variables using the syms variable. After that, we can write the equations in MATLAB. After that, we need to use the function solve () to solve the equations. For example, let’s define some equations in MATLAB and find their solution using the solve () function. See the code below. Output: The function linsolve() is used instead of the solve() function if you have matrices instead of equations. We can also convert the equations to matrix form using the equations To Matrix() function. For example, let’s define some equations in Matlab and find their solution using the linsolve() function. See the code below.
  • 33. Page | 33 By- Akshit Jain Enrol.no. – TEN2103001 Experiment 11 Determination of Roots of a Polynomial Using MATLAB Syntax r = roots(p) returns the roots of the polynomial represented by p as a column vector. Input p is a vector containing n+1 polynomial coefficients, starting with the coefficient of xn . For example, p = [3 2 -2] represents the polynomial 3x2+2x−2. A coefficient of 0 indicates an intermediate power that is not present in the equation. The root’s function solves polynomial equations of the form p1xn+...+pnx+pn+1=0. Polynomial equations contain a single variable with nonnegative exponents. Examples 1. Roots of Quadratic Polynomial: -  Use the poly function to obtain a polynomial from its roots: p = poly(r). The poly function is the inverse of the roots function.  Use the f zero function to find the roots of nonlinear equations. While the root’s function works only with polynomials, the zero function is more broadly applicable to different types of equations. Roots of a Polynomial
  • 34. Page | 34 By- Akshit Jain Enrol.no. – TEN2103001 Experiment 12 Solution of Difference Equations using MATLAB Software First-Order Linear ODE Solve this differential equation. dy/dx=ty Fiíst, represent y by using symsto create the symbolic function y(t).symsy(t) Define the equation using ==and represent diffeíentiation using the difffunction. ode = diff (y, t) == t*y ode(t) = diff(y(t), t) == t*y(t) Solve the equation using dsolve. ySol(t) = dsolve(ode) ySol(t)= C1*exp(t^2/2) Solve Differential Equation with Condition In the previous solution, the constant C1appears because no condition was specified. Solve the equation with the initial condition y(0) == 2. the dsolvefunction finds a value of C1that satisfies the condition. cond = y(0) == 2; ySol(t) = dsolve(ode,cond) ySol(t) =2*exp(t^2/2) . Nonlinear Differential Equation with Initial Condition: -Solve this nonlinear differential equation with an initialcondition. the equation has multiple solutions. Second-Oídeí ODE with Initial Conditions Solve this second-order differential equation with two initial conditions.
  • 35. Page | 35 By- Akshit Jain Enrol.no. – TEN2103001 d2 y/dx2 =cos(2x)-y y (0)=1 y’ (0)=0 Steps: -Define the equation and conditions. The second initial condition involves the first derivative of y. Represent the derivative by creating the symbolic function Dy = diff(y) and thendefine the condition using Dy (0) ==0. syms y(x) Dy = diff(y); ode = diff(y,x,2) == cos(2*x)-y;cond1 = y(0) == 1; cond2 = Dy(0) == 0; Solve odefor y. Simplify the solution using the simplifyfunction. conds = [cond1 cond2]; ySol(x) = dsolve(ode,conds);ySol = simplify(ySol) ySol(x) = 1 - (8*sin(x/2)^4)/3