Professional Documents
Culture Documents
Experiment No: 01
DETERMINATION OF BUS CURRENTS, BUS POWER AND LINE FLOWS
Aim: To determine the bus currents, bus power and line flows for any power system
Theory: The last step in the load flow analysis is computing the power flows, bus currents and bus
power on the various lines of the network. Consider the line connecting buses i and k. The line and
transformer at each end can be represented by a circuit with series admittance Yik and two shunt
admittances Yiko and Ykio as shown below.
Bus i Bus k
Iik Iki
Iik1 Yik
Ski
Ski Iik0 Ikio
Yik0 Yki0
The current fed by bus I into the line can be expressed as,
The power loss in the (i-k) the line is the sum of the power flows determined from the last two
equations. The transmission loss can be computed by summing all line flows (i.e Sik + Ski for all i, k).
The slack bus power can also be found by summing the flows on the lines terminating at the slack bus.
end
yline2=reshape(yline1,3,3) % line admittance
Sp=zeros(n,n)
for i=1:n
for k=1:n
if i==k
continue
else
I(i,k)=yline2(i,k)*(vbus(i)-vbus(k)); % line current
I(k,i)= -I(i,k)
S(i,k)=vbus(i)*conj(I(i,k)); % line power
S(k,i)=vbus(k)*conj(I(k,i));
Sl(i,k)=S(i,k)+S(k,i); % line losses
Sp(i,i)=Sp(i,i)+S(i,k); % bus power
end
end
end
Sbus=[Sp(1,1); Sp(2,2); Sp(3,3)]
%bus curent calculation ;-
Ibus=conj((Sbus./vbus)) % bus current
Input:
Yline= [0 0 10 -20 10 -30 10 -20 0 0 16 -32 10 -30 16 -32 0 0]
n= 3
Output:
line current matrix is
0.00+( 0.00)j 1.90+( -0.80)j 2.00+( -1.00)j
-1.90+( 0.80)j 0.00+( 0.00)j -0.64+( 0.48)j
POWER SYSTEM II VI SEM 2
DEPARTMENT OF0.64+(
-2.00+( 1.00)j ELECTRICAL ENGINEERING
-0.48)j 0.00+( 0.00)j PIEMR, INDORE
line flow matrix is
0.00+( 0.00)j 2.00+( 0.84)j 2.10+( 1.05)j
-1.91+( -0.67)j 0.00+( 0.00)j -0.66+( -0.43)j
-2.05+( -0.90)j 0.66+( 0.45)j 0.00+( 0.00)j
Line losses matrix is
0.00+( 0.00)j 0.09+( 0.17)j 0.05+( 0.15)j
0.09+( 0.17)j 0.00+( 0.00)j 0.01+( 0.02)j
0.05+( 0.15)j 0.01+( 0.02)j 0.00+( 0.00)j
Bus power matrix is
4.10+( 1.89)j 0.00+( 0.00)j 0.00+( 0.00)j
0.00+( 0.00)j -2.57+( -1.10)j 0.00+( 0.00)j
0.00+( 0.00)j 0.00+( 0.00)j -1.39+( -0.45)j
Sbus matrix is
4.10+( 1.89)j -2.57+( -1.10)j -1.39+( -0.45)j
Ibus matrix is
3.90+( -1.80)j -2.54+( 1.28)j -1.36+( 0.52)j
Result:
Viva-Voice:
Experiment No. : 02
Aim: To determine the Swing curve of a single machine connected to infinite bus
Theory:
The load angle or the torque angle δ depends upon the loading of the machine, larger the loading larger
is the value of the torque angle. If some load is added or removed from the shaft of the synchronous
machine the rotor will decelerate or accelerate respectively with respect to rotating magnetic field. The
rotor swings with respect to the stator field. The equation describing the relative motion of the rotor
with respect to the stator field as a function of time is known as swing equation. The swing equation is
given below
Md2δ = Ps – Pe
Where Pe is Pm sin δ
M is the angular momentum of the rotor
δ is the torque angle Ps is the power input
Pe is the electromagnetic power output
In case ‘δ’ increases indefinitely it indicates instability where as if it reaches a maximum and starts
decreasing,it shows that the system will not lose stability since the oscillations will be damped out with
time.
For the stability of the system dδ = 0
Swing curve:
The solution of swing equation gives the relation between rotor angle ‘δ’ as a function of time ‘t’ . The
plot of ‘δ’ versus ‘t’ is called as swing curve. No analytical solution of this equation exists. However,
techniques are available to obtain approximate solution of such differential equations by numerical
methods and one must therefore resort to numerical computation techniques. Some of the commonly
used numerical techniques for the solution of the swing equation are:
• Point by point method
Note: In this program the swing equation is solved using Runge Kutta method
MATLAB PROGRAM:
clc
clear all
tfc=input('enter fault clearing time=');
pi = 0.9;
e1=1.1;
e2=1.0;
m=0.016;
x0=0.45;
x1=1.25;
x2=0.55;
pm0=(e1*e2)/x0;
pm1=(e1*e2)/x1;
pm2=(e1*e2)/x2;
w=0;
d=asin(pi/pm0);
for t=0:0.05:1
dg=d*180/3.1414;
if(t<tfc)
pm=pm1;
else
pm=pm2;
end
k1=w*.05;
l1=(pi-pm*sin(d))*.05/m;
Result :
Viva voce:
1. What is meant by rotor angle stability?
2. What is meant by steady state stability?
3. Define- Critical Clearing Angle
4. What is meant by small signal stability?
5. Define – Critical Clearing Time
Experiment No: 03
JACOBIAN MATRIX CALCULATION
Aim: Formation of Jacobian for a system not exceeding 4 buses *(no PV buses) in polar coordinates
Theory:
The Jacobian matrix gives the linearized relationship between small changes in voltage angle δi (k) and
voltage magnitude Δ│Vi │(k) with the small changes in real and reactive power Pi (k) and
MATLAB program:
clc
clear all
n=4
v=[1 1 1 1]
ybus=[70-90j -20+40j -50+50j 0+0j;-20+40j 43.08-55.39j 0+0j -23.077+15.39j; -50+50j 0+0j 75-75j
-25+25j;0+0j -23.077+15.39j -25+25j 48.077-40.39j]
for i=1:n
for j=1:n
y(i,j)=abs(ybus(i,j))
yn(i,j)=angle(ybus(i,j))
v(i)=abs(v(i))
vn(i)=angle(v(i))
end
end
POWER SYSTEM II VI SEM 8
DEPARTMENT
J1=zeros(n,n) OF ELECTRICAL ENGINEERING PIEMR, INDORE
J2=zeros(n,n)
J3=zeros(n,n)
J4=zeros(n,n)
i=2
while i<=n
J2(i,i)=J2(i,i)+2*v(i)*y(i,i)*cos(yn(i,i))
J4(i,i)=J4(i,i)-2*v(i)*y(i,i)*sin(yn(i,i))
for j=1:n
if i==j
continue;
else
J1(i,i)=J1(i,i)+v(i)*v(j)*y(i,j)*sin(yn(i,j)-vn(i)+vn(j))
J1(i,j)=-1*v(i)*v(j)*y(i,j)*sin(yn(i,j)-vn(i)+vn(j))
J2(i,i)=J2(i,i)+v(j)*y(i,j)*cos(yn(i,j)-vn(i)+vn(j))
J2(i,j)=v(i)*y(i,j)*cos(yn(i,j)-vn(i)+vn(j))
J3(i,i)=J3(i,i)+v(i)*v(j)*y(i,j)*cos(yn(i,j)-vn(i)+vn(j))
J3(i,j)=-1*v(i)*v(j)*y(i,j)*cos(yn(i,j)-vn(i)+vn(j))
J4(i,i)=J4(i,i)-v(j)*y(i,j)*sin(yn(i,j)-vn(i)+vn(j))
J4(i,j)=-1*v(i)*y(i,j)*sin(yn(i,j)-vn(i)+vn(j))
end
end
i=i+1
end
J11=J1(2:n,2:n)
J22=J2(2:n,2:n)
J33=J3(2:n,2:n)
J44=J4(2:n,2:n)
Jacobian=[J11 J22;J33 J44]
Result:
Experiment No: 04
Aim: To develop a computer program to form the bus admittance matrix, Ybus of a power system.
Theory:
The Ybus /Zbus matrix constitutes the models of the passive portions of the power network. Y bus matrix is
often used in solving load flow problems. It has gained widespread applications owing to its simplicity
POWER SYSTEM II VI SEM 10
DEPARTMENT OFand
of data preparation ELECTRICAL ENGINEERING
the ease with which the bus admittance matrix can be formedPIEMR, INDORE
and modified for
network changes. Of course, sparsity is one of its greatest advantages as it heavily reduces computer
memory and time requirements. In short circuit analysis, the generator and transformer impedances
must also be taken into account. In contingency analysis, the shunt elements are neglected, while
forming the Z-bus matrix, which is used to compute the outage distribution factors.
This can be easily obtained by inverting the Y-bus matrix formed by inspection method or by
analytical method. The impedance matrix is a full matrix and is most useful for short circuit studies.
Initially, the Y-bus matrix is formed by inspection method by considering line data only. After forming
the Y-bus matrix, the modified Y-bus matrix is formed by adding the generator and transformer
admittances to the respective diagonal elements and is inverted to form the Z-bus matrix.
The performance equation for a n-bus system in terms of admittance matrix can be written as,
The admittances Y11, Y12,… Y1n are called the self-admittances at the nodes and all other admittances
are called the mutual admittances of the nodes.
Formulae Used
Main diagonal element in Y-bus matrix =
Flowchart:
Start
Is i = n
STOP
Algorithm:
Step 1: Read the values of number of buses and the number of lines of the given
system.
Step 2: Read the self-admittance of each bus and the mutual admittance between
the buses.
Step 3: Calculate the diagonal element term called the bus driving point admittance,
Yij which is the sum of the admittance connected to bus i.
Sample Problem:
The bus and branch datas for a 3 bus system is given in table below. Form Y bus matrix by
inspection method.
Result :
Viva Voce:
1. What is meant by bus admittance matrix?
2. How are the loads represented in reactance or impedance diagram?
3. What are the different methods to solve bus admittance matrix?
4. Draw the single line diagram showing the essential parts in the power system network.
5. What are the elements of the bus admittance matrix?
6. Name the diagonal and off diagonal elements of bus admittance matrix.
7. Define per unit value.
8. What are the advantages of per unit computations?
Experiment No: 05
Problem Formulation
The performance equation of the power system may be written of
Selecting one of the buses as the reference bus, we get (n-1) simultaneous equations. The
bus loading equations can be written as
The above equation is the required formula .this equation can be solved for voltages in interactive
manner. During each iteration, we compute all the bus voltage and check for convergence is carried
out by comparison with the voltages obtained at the end of previous iteration. After the solutions is
obtained. The stack bus real and reactive powers, the reactive power generation at other generator
buses and line flows can be calculated.
Algorithm:
Step1: Read the data such as line data, specified power, specified voltages, Q limits at the generator
buses and tolerance for convergences
Step2: Compute Y-bus matrix.
Step3: Initialize all the bus voltages.
Step12: Calculate the slack bus power, Q at P-V buses real and reactive give flows real and reactance
line losses and print all the results including all the bus voltages and all the bus angles.
Step13: Stop.
Procedure:
PROBLEM:
The following figure shows the one-line diagram of a simple three-bus power system with generation
at bus 1. The magnitude of voltage at bus 1 is adjusted to 1.05 per unit. The scheduled loads at buses 2
and 3 are as marked on the diagram. Line impedances are marked in per unit on a 100-MVA base and
the line charging susceptances are neglected. Using the Gauss-Seidel method, determine the phasor
values of the voltage at the load buses 2 and 3 (P-Q buses) accurate to four decimal places and obtain
full solution using MATLAB.
MATLAB PROGRAM:
clc
clear all
n=3;
V=[1.05 1 1];
diff=10;
iter=1;
Vprev=V;
abs(V);
abs(Vprev);
Vprev=V;
for i=2:n
sumyv=0;
for k=1:n,
if(i~=k)
end
end
V(i)=(1/Y(i,i))*((P(i)-j*Q(i))/conj(V(i))-sumyv);
end
diff=max(abs(abs(V(2:n))-abs(Vprev(2:n))));
Viter=iter+1
end
Result :
Viva Voce
1. What is meant by load flow analysis?
2. What is meant by acceleration factor?
3. Define – Slack Bus
4. Define – Generator Bus
5. What are the different types of buses in power system network?
6. What is meant by bus?
7. What is the need for swing bus?
8. What is meant by acceleration factor in load flow solution? What is its best value?
9. List the advantages of Gauss-Siedal method.
10. List the advantages of load flow analysis.
11. What is meant by P-Q bus in power flow analysis?
12. How is load flow study performed?
13. What is meant by slack bus?
Experiment No: 06
Aim: To determine the bus impedence matrix for the given power system Network
POWER SYSTEM II VI SEM 17
DEPARTMENT OF ELECTRICAL ENGINEERING PIEMR, INDORE
Apparatus: PC loaded with MATLAB
Theory:
The Ybus /Zbus matrix constitutes the models of the passive portions of the power network. The
impedance matrix is a full matrix and is most useful for short circuit studies. An algorithm for
formulating [Zbus] is described in terms of modifying an existing bus impedance matrix designated as
[Zbus]old. The modified matrix is designated as [Zbus]new. The network consists of a reference bus and a
number of other buses. When a new element having self impedance Zb is added, a new bus may be
created (if the new element is a tree branch) or a new bus may not be created (if the new element is a
link). Each of these two cases can be subdivided into two cases so that Z b may be added in the
following ways:
1. Adding Zb from a new bus to reference bus.
Let the current through bus p be Ip, then the voltage across the bus p is given by, Vp = Ip Zb
The potential at other buses remains unaltered and the system equations can be written as,
Type 2 modification:
In type 2 modification, an impedance Zb is added between a new bus p and an existing bus k as shown
in Figure 2. The voltages across the bus k and p can be expressed as,
V k(new) = Vk + Ip*Zkk
= Vk + Ip(Zb + Zkk)
Type 3 Modification:
POWER SYSTEM II VI SEM 19
DEPARTMENT OF ELECTRICAL ENGINEERING PIEMR, INDORE
In this modification, an impedance Zb is added between a existing bus k and a reference bus.
Then the following steps are to be followed:
1. Add Zb between a new bus p and the existing bus k and the modifications are done as in type 2.
2. Connect bus p to the reference bus by letting Vp = 0.
To retain the symmetry of the Bus Impedance Matrix, network reduction technique can be used
to remove the excess row or column.
Type 4 Modification:
In this type of modification, an impedance Zb is added between two existing buses j and k as shown in
Figure 3. From Figure 3, the relation between the voltages of bus k and j can be written as,
Vk – Vj = IbZb (3)
1
n
Ij + I b
Network j
Z Ib
b
k
Ik - Ib
Ref. Bus
The voltages across all the buses connected to the network changes due to the addition of impedance
Zb and they can be expressed as,
V1 = Z11I1 + Z12I2 + - - - - - - - - + Z1j(Ij + Ib) + Z1k(Ik – Ib)+- - -
V2 = Z21I1 + Z22I2 + - - - - - - - - + Z2j(Ij + Ib) + Z2k(Ik – Ib)+ - - -
Vj = Zj1I1 + Zj2I2 + - - - - - - - - + Zjj(Ij + Ib) + Zjk(Ik – Ib) + - - - (4)
Vk = Zk1I1 + Zk2I2 + - - - - - - - - + Zkj(Ij + Ib) + Zkk(Ik – Ib) + - - -
Vn = Zn1I1 + Zn2I2 + - - - - - - - - + Znj(Ij + Ib) + Znk(Ik – Ib) + - - -
On solving the Equations (3) and (4), the system of equations can be rewritten as,
Sample problem:
Form bus impedance matrix using building algorithm:
Solution:
Step1: Add an element between ref (0) bus and a new bus (1).
Z = [j0.2]
Step2: Add an element between existing bus (1) to a new bus (2).
j0.2 j0.2
Z=
j0.2 j0.6
Step3: Add an element between existing (2) Bus to a ref (0) Bus.
New Z Bus:
Z11 = Z11-(Z31*Z13)/Z33
j0.05 j0.05
Z Bus =
j0.05 j0.15
Result:
Viva Voce:
Experiment No: 07
AIM: To study different types of software used for Power Flow Analysis
THEORY:
Power flow analysis is the backbone of power system analysis and design. They are necessary for
planning, operation, economic scheduling and exchange of power between utilities. The principal
information of power flow analysis is to find the magnitude and phase angle of voltage at each bus
and the real and reactive power flowing in each transmission lines. Power flow analysis is an
importance tool involving numerical analysis applied to a power system. In this analysis, iterative
techniques are used due to there no known analytical method to solve the problem. To finish this
analysis there are methods of mathematical calculations which consist plenty of step depend on the
size of system. This process is difficult and takes a lot of times to perform by hand. The objective of
this project is to develop a toolbox for power flow analysis that will help the analysis become easier.
Over the past decade, a few versions of educational software packages using advanced programming
languages, such as C, C++, Pascal, or FORTRAN have been developed for power engineering
curriculums. These choose an integrated study platform with support of database and GUI functions.
This experiment is design to explore students with various types of software that are utilized to study
power flow analysis. Few power flow analysis are Newton Raphson, fast decoupled, & accelerated
Gauss Seidel , Generator governors with isochronous or droop mode, Generator exciters with AVR or
MVAR / PF controllers, Transformer load tap changers (LTC / regulators), Advanced solution
techniques for fast convergence, Multiple loading conditions, Multiple generation conditions, Swing,
voltage regulated, & unregulated power sources, Voltage drop calculations, Load forecasting , Alert
view to display critical & marginal limit violations, Bus / transformer / cable overload warning,
Single-phase load flow display, Global & individual bus diversity factors, Individual demand factors
for continuous, intermittent, & spare operating conditions, Option to update the initial condition from
load flow solutions, Phase-shifting transformer, Power factor correction, Multi-report result analyzer
etc. Some of the software is as follows:
1. ETAP Load Flow software performs power flow analysis and voltage drop calculations with
accurate and reliable results. Built-in features like automatic equipment evaluation, alerts and
2. MATLAB & PSAT: Power flow analysis software package develops by the author use
MATLAB programming and MATLAB GUI. Data visualization and GUI design in MATLAB are
based on the Handle Graphics System in which the objects organized in a Graphics Object Hierarchy
can be manipulated by various high and low level commands. This software
3. provides all three methods that commonly used, Newton Raphson method, Gauss-Seidel method and
Fast Decoupled method in solving the power flow or load flow problem.
4. SCILAB: Developed at INRIA, Scilab has been developed for system control and signal processing
applications. It is freely distributed in source code format (see the copyright file). A key feature of the
Scilab syntax is its ability to handle matrices: Polynomials, polynomials matrices and transfer matrices
are also defined and the syntax used for manipulating these matrices is identical to that used for
manipulating constant vectors and matrices. Scilab provides a variety of powerful primitives for the
analysis of non-linear systems. Integration of explicit and implicit dynamic systems can be accomplished
numerically. The scicos(similar to simulink) toolbox allows the graphic definition and simulation of
complex interconnected hybrid systems. There exist numerical optimization facilities for non linear
optimization (including non differentiable optimization), quadratic optimization and linear optimization.
Scilab has an open programming environment where the creation of functions and libraries of functions is
completely in the hands of the user.
PROCEDURE:
Viva voce:
1. Is an electrical software an virtual laboratory?
2. Which are the Virtual laboratory Benefits?
3. What is Voltage Stability Toolbox (VST)?
4. What is SPS (SimPowerSystems)?
5. What is PSAT (Power system Analysis Tool)?
6. What is PAT (Power Analysis Toolbox)?
Result:
Viva Voce:
1. What is meant by single area system?
2. What is meant by load frequency control?
3. What is meant by automatic generation control?
4. What is meant by speed regulation?
5. What is meant by inertia constant?
6. What are the major control loops used in large generators?
7. What is the use of secondary loop?
8. What is the advantage of AVR loop over ALFC loop?
9. What is the difference between large and small signal analysis?
EXPERIMENT NO: 09
AIM: Testing of Polarity, Ratio and magnetisation characteristics of current Transformer and Potential
Transformer.
THEORY:
Current Transformer and potential Transformer are known as instrument transformer. In a high voltage
and high current circuit direct measurement of voltage, current and other electrical parameter
instrument transformer are used. PT is connected to the main bus of the associated power system,
stepped down secondary voltage is measured by the instrument displayed actual high voltage after
proper calibration. Primary of CT connected in series with the equipment whose current is to be
measured and the secondary current measured by the instrument displayed actual high primary current
after proper calibration. Using CT and PT we can electrically isolate the measuring devices from the
main circuit and measuring device can be placed any far distance in control room.
VA burden of CT and PT is being calculated from their voltage and current loading to the maximum
polarities of transformer define the phase shift between two sides, which is either 0 0 or 1800. There are
two type of CT one is measuring CT and other is protection CT.
Then a single CT output is fed to an ammeter or a PT output fed to a voltmeter there is no need to
know the polarity of transformer. But when CT and PT connected in star or delta in case of three phase
circuit they must be connected according to their polarity. Performing polarity test we can find out the
symmetrical terminals between primary and secondary wingding of a CT and PT.
Using ratio test we can find out the voltage ratio for PT and current ratio for CT between primary and
secondary at different point throughout its full operating range. Through this test we can also find out
whether it is constant at all point or not.
Transformer core must not be saturated within its operating zone. If it saturated then due to change of
input voltage or current in primary make no change in secondary that cause the error in measurement.
We can determine its property from the data of ratio test. If the transformer ratio never changes
between its full operating ranges means that core of the transformer is healthy condition.
1.
2.
3.
PROCEDURE:
1) Connect the circuit as per circuit diagram and marked the each terminals of primary and
secondary wingding input voltage at suitable value. Read the input voltage (V1) and output
voltage (V2).
2) If the voltmeter connected between primary and secondary reads the sum of voltages of (V1 +
V2). Then P1 and S1 are opposite polarity.
3) If the voltmeter connected between primary and secondary reads the difference of voltages of
(V1 – V2). Then P1 and S1 are same polarity.
1) Connect the circuit as per circuit diagram and marked the each terminals of primary and
secondary wingding.
2) Be sure the input voltage polarity to the input terminals and polarity of centre galvanometer
connection in the output terminals.
3) Operate the push button for a fraction of time. Find the direction of deflection of the zero centre
galvanometer.
4) If deflection is right hand side that means supply positive terminal and galvanometer positive
terminal is same polarity. If deflection is left hand side that means supply positive terminal and
galvanometer positive terminal is opposite polarity.
5) Repeat the whole experiments after reversing the source.
Result:
Viva Voce:
EXPERIMENT No: 10
AIM: To conduct the load flow analysis by using an ETAP power station.
THEORY:
ETAP power station is a fully graphical electrical transient analyzer program that can operate under the
Microsoft windows 98, NT4-0, 2000 and XP environments. The Windows 2000 and XP Professional
platforms provide the highest performance level for demanding applications, such as large network
analysis requiring intensive computation and online monitoring and control applications. PowerStation
allows us to work directly with graphical one-line diagrams, underground cable raceway systems,
ground grid systems and cable pulling systems. Power station combines the electrical, logical,
mechanical and physical attributes of system elements in the same data base. ETAP can simulate
various power system problems like load flow analysis, short circuit analysis, Harmonic analysis,
Transient Stability analysis, Optimal power flow analysis, motor acceleration analysis, Battery sizing
discharge, DC load flow and DC short circuit analysis. Power station organizers and accesses its
database using Microsoft open database connectivity (ODBC)
General steps for ETAP Simulation:
POWER SYSTEM II VI SEM 35
DEPARTMENT OFa new
Step 1: (To create ELECTRICAL
project) ENGINEERING PIEMR, INDORE
1. To start power station, double click on the power station icon on desktop. This will open the
window.
2. To create a new project, select the file menu option from the start up menu Bark click on the first
button on the project tool bar
3. The user information dialog box comes up after you click on ok from the create project file.
4. Enter the user name, full name and description and password click on ok in dialogue box.
Step 2: (Project Properties)
Under the project menu there are some options as follows to give or edit the properties. The
information and standard of the projects can be edited from this menu.
One line diagram menu bar contains a comprehensive collection of menu options. This menu bar is
displayed when a one line diagram is active. In the one line diagram presentation (OLV1), we can
graphically construct our electrical system by connecting the buses, branches motors etc. from the one
line diagram Edit tool bar.
Click on the required symbol on the edit tool bar which changes the cursor shape to the elements
picture.
Step 5: (Rotation)
For this right click to bring up the menu and select one of the orientations
Result:
Viva Voce:
1. Introduction to MATLAB:
MATLAB is a widely used numerical computation package. It serves both as a simple calculator and
as a sophisticated tool for making long complicated calculations and plot graphs of different functions
depending upon requirement. Models of dynamic systems can be built easily using SIMULINK.
To start using MATLAB/SIMULINK, open editor to create an m-file or an .mdl Simulink model in
Simulink window. Always save using file names without breaks in words.
2. Basic Commands:
Some basic MATLAB commands are given as follows. Type these at the command prompt to verify.
Creating a Vector:
Let’s create a simple vector with 9 elements called a.
a = [1 2 3 4 6 4 3 4 5]
a=
1 2 3 4 6 4 3 4 5
Now let's add 2 to each element of our vector, a, and store the result in a new vector.Notice
how MATLAB requires no special handling of vector or matrix math.
Adding an element to a Vector:
b=a+2
b=
3 4 5 6 8 6 5 6 7
Plots and Graphs:
Creating graphs in MATLAB is as easy as one command. Let's plot the result of our vector
addition with grid lines.
plot (b)
grid on
MATLAB can make other graph types as well, with axis labels.
bar(b)
xlabel('Sample #')
ylabel('Pounds')
MATLAB can use symbols in plots as well. Here is an example
using stars to mark the points. MATLAB offers a variety of other
symbols and line types.
plot(b,'*')
POWER SYSTEM II VI SEM 39
DEPARTMENT OF ELECTRICAL ENGINEERING PIEMR, INDORE
axis([0 10 0 10])
Creating a matrix:
One area in which MATLAB excels is matrix computation. Creating a matrix is as easy as making
a vector, using semicolons (;) to separate the rows of a matrix.
A=[120;25-1;410-1]
A=
1 2 0
2 5 -1
4 10 -1
Adding a new Row:
A(4,:)=[7 8 9]
ans=
1 2 0
2 5 -1
4 10 -1
7 8 9
Transpose:
We can easily find the transpose of the matrix A.
A=[120;25-1;410-1]
A' =
1 2 4
6. 5 10
0 -1-1
Matrix Multiplication:
Now let's multiply these two matrices together. Note again that MATLAB doesn't require you to
deal with matrices as a collection of numbers. MATLAB knows when you are dealing with matrices
and adjusts your calculations accordingly.
A=[111;222;333]
B=[444;555;666]
j =A*B
k =
Instead of doing a matrix multiply, we can multiply the corresponding elements of two matrices
or vectors using the’.* ‘operator.
C =A.*B
C =
4 4 4
10 10 10
18 18 18
Inverse:
Let's find the inverse of a matrix
A=[120;25-1;410-1]
X=inv(A)
X=
5 2 -2
-2 -1 1
0 -2 1