PSA-1 Lab Manual Final 4-2-25
PSA-1 Lab Manual Final 4-2-25
VI SEMESTER
IPCC COURSE
(BEE601)
NAME:……………………………
USN: ……………………………..
SEM:…………BATCH:………………
Prepared by:
Vision Mission
To become a recognized
To provide learning opportunity that fosters student’s
technical education centre with
ethical values, intelligent development in science &
global perspective
technology and social responsibility so that they become
sensible and contributing members of the society.
Department
Vision Mission
To become one among the best departments M1: To provide learner-centric environment
through quality education and training.
in engineering and research arena through
M2: To lay the foundation for research by
professional faculty and state of art fortifying peers & establishing incubation
center.
laboratories and to make the students
M3: To develop the overall personality of
successful engineers with good ethics the students to face the challenges of the real
world.
PEO1 Graduates will be employable in industries like power sector, IT sector, embedded/
automation sector, allied sectors and adopt to rapidly evolving technologies.
PEO2 Graduates can embark on the interest of pursuing master’s degree and/or research in
multidisciplinary and trending domains.
PEO3 Graduates will be employers and self-employed with imbibed leadership qualities, teamwork
ingenuity, ethics and societal concerns.
The Electrical and Electronics Engineering program must demonstrate that graduates can
PSO1
design and analyze systems that efficiently generate, transmit & distribute, measurement,
protection and utilization of electric power.
The Electrical and Electronics Engineering program must demonstrate that graduates can
PSO2
understand the Operation of Electrical machines, Drives and their Control using Electronic
Circuits and applying to the ever evolving societal and Industrial needs
The Electrical and Electronics Engineering program must demonstrate design, analyze,
PSO3
implement and test the analog & digital circuits, signal processing, microcontrollers &
computer programming
PROGRAM OUTCOMES (POs)
Engineering Graduates will be able to:
SL Max.
Criteria
No. Marks=50
1 Writeup/Preparation (W) 10
2 Conduction (C) 10
3 Viva (V) 10
4 Record Writeup (R) 20
SL Max
Criteria
No. Marks=50
Procedure write-up on given
1 10
Experiment
Conduction / Execution of 25
2
Experiment
3 Analysis & Viva 15
• To introduce the per unit system and explain its advantages and computation and explain the
concept of single line (one line) diagram and its implementation in problems.
• To explain analysis of three phase symmetrical faults on synchronous machine and simple power
systems.
• To explain symmetrical components, their advantages and the calculation of symmetrical
components of voltages and currents in un-balanced three phase circuits.
• To explain the concept of sequence impedance and sequence networks in three phase
unbalanced circuits.
• To explain the analysis of synchronous machine and simple power systems for different
unsymmetrical faults using symmetrical components.
• Discuss stability and types of stability for a power system and the equal area criterion for the
evaluation of stability of a simple system.
Sl.NO Experiments
1 Write a program to draw power angle curves for salient and non-salient pole synchronous
machines, reluctance power, excitation, EMF and regulation.
2
Write a program to calculate Sag of a transmission line for
i)Poles at equal height ii)Poles at unequal height
3 Write a program to determine the efficiency, Regulation, ABCD parameters for short and long
transmission line and verify AD-BC=1.
4 Write a program to determine the efficiency, Regulation and ABCD parameters for medium
transmission line for i) П- configuration ii) T- Configuration and verify AD-BC=1.
5 Write a program to calculate sequence components of line voltages given the unbalanced
phase voltages.
6 Write a program to calculate the sequence components of line currents, given the unbalanced
phase currents in a three phase i) 3-wire system ii) 4 wire system.
7 Determination of fault currents and voltages in a single transmission line for
i) Single Line to Ground Fault. ii)Line to Line Fault
iii) Double Line to Ground Fault Using suitable simulating software package.
8 Determination of fault currents and voltages in a single transmission line for Three phase Fault
Using suitable simulating software package.
9 Write a program to obtain critical disruptive voltage for various atmospheric and conductor
conditions.
10 Write a program to evaluate transient stability of single machine connected to infinite bus.
Course outcomes (Course Skill Set):
At the end of the course, the student will be able to:
1. Model the power system components &construct per unit impedance diagram of power
system.
2. Analyse three phase symmetrical faults on power system.
3. Compute unbalanced phasors in terms of sequence components and vice versa, also develop sequence
networks.
4. Analyse various unsymmetrical faults on power system.
5. Examine dynamics of synchronous machine and determine the power system stability.
• Assessment Details (both CIE and SEE)
• The weightage of Continuous Internal Evaluation (CIE) is 50% and for Semester End Exam (SEE) is 50%. The
minimum passing mark for the CIE is 40% of the maximum marks (20 marks out of 50) and for the SEE
minimum passing mark is 35% of the maximum marks (18 out of 50 marks). The student is declared as a pass
in the course if he/she secures a minimum of 40% (40 marks out of 100) in the sum total of the CIE
(Continuous Internal Evaluation) and SEE (Semester End Examination) taken together.
• The IPCC means the practical portion integrated with the theory of the course. CIE marks for the theory
component are 25 marks and that for the practical component is 25 marks.
• CIE for the theory component of the IPCC
• 25 marks for the theory component are split into 15 marks for two Internal Assessment Tests (Two Tests, each
of 15 Marks with 01-hour duration, are to be conducted) and 10 marks for other assessment methods
mentioned in 22OB4.2. The first test at the end of 40-50% coverage of the syllabus and the second test after
covering 85-90% of the syllabus.
• Scaled-down marks of the sum of two tests and other assessment methods will be CIE marks for the theory
component of IPCC (that is for 25 marks).
• The student has to secure 40% of 25 marks to qualify in the CIE of the theory component of IPCC.
CIE for the practical component of the IPCC
• 15 marks for the conduction of the experiment and preparation of laboratory record, and 10 marks for the test
to be conducted after the completion of all the laboratory sessions.
• On completion of every experiment/program in the laboratory, the students shall be evaluated including viva-
voce and marks shall be awarded on the same day.
• The CIE marks awarded in the case of the Practical component shall be based on the continuous evaluation of
the laboratory report. Each experiment report can be evaluated for 10 marks. Marks of all experiments’ write-
ups are added and scaled down to 15 marks.
• The laboratory test (duration 02/03 hours) after completion of all the experiments shall be conducted for 50
marks and scaled down to 10 marks.
• Scaled-down marks of write-up evaluations and tests added will be CIE marks for the laboratory component of
IPCC for 25 marks.
• The student has to secure 40% of 25 marks to qualify in the CIE of the practical component of the IPCC.
• The student is declared as a pass in the course if he/she secures a minimum of 40% (40 marks out of
100) in the sum total of the CIE (Continuous Internal Evaluation) and SEE (Semester End
Examination) taken together.
Reference Books
1. Elements of Power System, William D. Stevenson Jr, McGraw Hill, 4th Edition, 1982.
2. Power System Analysis and Design, J. Duncan Gloveretal, Cengage, 4th Edition, 2008.
3. Power System Analysis, Hadi Sadat, McGraw Hill,1stEdition,2002.
Web links and Video Lectures (e-Resources): https://nptel.ac.in/courses/108104051
CONTENTS
CYCLE OF EXPERIMENTS ........................................................................................................ 2
Experiment- 1 .................................................................................................................................. 3
Power angle curves for Salient and Non-Salient Pole Synchronous Machines .............................. 3
Experiment- 2 .................................................................................................................................. 6
Calculation of Sag of a transmission line ........................................................................................ 6
Experiment- 3 .................................................................................................................................. 9
Efficiency, Regulation, ABCD parameters for Short and Long Transmission Line ....................... 9
Experiment- 4 ................................................................................................................................ 15
Efficiency, Regulation and ABCD parameters for Medium Transmission Line .......................... 15
Experiment- 5 ................................................................................................................................ 18
Calculation of Sequence Components of Line Voltages given the Unbalanced Phase Voltages.. 18
Experiment- 6 ................................................................................................................................ 21
Calculation of Sequence Components of Line Currents given the Unbalanced Phase Currents in a
Three-phase System ....................................................................................................................... 21
Experiment- 7 ................................................................................................................................ 26
Determination of Fault Currents & Voltages in a Single Transmission Line for Unsymmetrical
faults .............................................................................................................................................. 26
Experiment- 8 ................................................................................................................................ 44
Determination of Fault Currents & Voltages in a Single Transmission Line for Three-phase fault
....................................................................................................................................................... 44
Experiment- 9 ................................................................................................................................ 45
Critical Disruptive Voltage for Various Atmospheric and Conductor Conditions ....................... 45
Experiment- 10 .............................................................................................................................. 47
Transient Stability of Single Machine Connected to Infinite Bus ................................................. 47
QUESTIONS BANK ..................................................................................................................... 52
VIVA QUESTIONS ...................................................................................................................... 53
ANNEXURE ................................................................................................................................. 66
CYCLE OF EXPERIMENTS
I. CYCLE
1. Power angle curves for Salient and Non-Salient Pole Synchronous Machines
2. Calculation of Sag of a transmission line
3. Efficiency, Regulation, ABCD parameters for short & long transmission line.
4. Efficiency, Regulation & ABCD parameters for medium transmission line.
5. Critical disruptive voltage for various atmospheric and conductor conditions.
II. CYCLE
1. Calculation of sequence components of line voltages given the unbalanced phase voltages.
2. Calculation of sequence components of line currents, given the unbalanced phase currents in
a three-phase i) 3-wire system ii) 4 wire system.
3. Determination of fault currents & voltages in a single transmission line for three phase faults.
4. Determination of the fault currents and voltages in a single transmission line for
unsymmetrical faults.
5. Transient stability of single machine connected to infinite bus.
Experiment- 1
Aim: Write a program in MATLAB to draw power angle curves for salient and non-salient pole
synchronous machines and determine reluctance power, excitation EMF and regulation.
Tool: MATLAB
Theory: The power angle curve describes the relationship between the electrical power output
of a synchronous machine and the power angle (δ), which is the phase angle between the internal
EMF (Eq) and the terminal voltage (V). This curve is crucial for understanding the stability and
operation of synchronous machines.
Program:
% CLEAR COMMAND WINDOW
clc;
clear all;
% INPUTS
P = input('Enter Power in MW = ');
pf = input('Enter Power factor = ');
Vt = input('Enter L-L Voltage in KV = ');
Xd = input('Enter Xd in ohms = ');
Xq = input('Enter Xq in ohms = ');
% CALCULATIONS
Vph = (Vt * 1000) / sqrt(3);
pf_a = acos(pf);
Q = P * tan(pf_a);
I = (P - 1j * Q) * 1e6 / (3 * Vph);
delta = 0:1:180;
delta_rad = delta * (pi / 180);
if Xd == Xq
% Non-Salient Pole
Ef = Vph + 1j * I * Xd
Department of EEE, SJBIT Page 3
Power System Analysis-1 Lab [BEE601] 2024-25
Excitation_emf = abs(Ef)
regulation = (Excitation_emf - Vph) * 100 / Vph
net_power = (3 * Excitation_emf * Vph * sin(delta_rad) / Xd) / 1e6;
plot(delta, net_power);
legend('Non-Salient Power');
else
% Salient Pole
Eq = Vph + 1j * I * Xq
Id_mag = abs(I) * sin(angle(Eq) - angle(I));
Ef_mag = abs(Eq) + (Xd - Xq) * Id_mag;
Excitation_emf = Ef_mag
regulation = (Ef_mag - Vph) * 100 / Vph
pp = Ef_mag * Vph * sin(delta_rad) / Xd;
reluct_power = (Vph^2 /2) * sin(2 * delta_rad)* ((1/Xd)-(1/Xq));
net_power_sal = (3 * (pp + reluct_power)) / 1e6;
net_reluct_power = (3 * reluct_power) / 1e6;
plot(delta, net_reluct_power, 'k', delta, net_power_sal, 'r');
legend('Reluctance Power', 'Salient Power');
end
xlabel('Delta in degrees');
ylabel('Three-phase power in MW');
grid on;
Explanation:
Input Data:
Salient Pole Machine Non-salient pole machine
Enter Power in MW = 48 Enter Power in MW = 48
Enter Power factor = 0.8 Enter Power factor = 0.8
Enter L-L Voltage in KV = 34.64 Enter L-L Voltage in KV = 34.64
Xd in ohms = 13.5 Xd in ohms = 10
Xq in ohms = 9.33 Xq in ohms = 10
Output:
Salient Pole Machine Non-salient pole machine
Excitation_emf = 3.0000e+04 Excitation_emf = 2.7203e+04
regulation = 50.0024 regulation = 36.0171
Plot Plot
Experiment- 2
Tool: MATLAB
Theory: Sag is the vertical distance between the highest point of a transmission line (at the
pole) and its lowest point. It is a crucial parameter in overhead line design to ensure proper
ground clearance and mechanical stability.
1. Poles at Equal Height
When poles are at the same height, the sag forms a symmetrical parabolic curve. The sag (S) at
mid-span is given by:
Where:
w: Weight of the conductor per unit length (N/m),
L: Span length (m),
T: Horizontal tension in the conductor (N).
Sag increases with span length and decreases with higher tension.
Program:
% Input parameters from the user
fprintf('\n Enter the data’s for Equal length');
w = input('\nEnter the weight of the conductor per unit length (kg/m): ');
L = input('\nEnter the span of the conductor (m): ');
T = input('\nEnter the tension in the conductor (kg): ');
Input Data:
Enter the data’s for Equal length
Enter the weight of the conductor per unit length (kg/m): 0.75
Enter the span of the conductor (m): 250
Enter the tension in the conductor (kg): 1500
Enter the data’s for Unequal length
Enter the weight of the conductor per unit length (kg/m): 0.8
Enter the tension in the conductor (kg): 1100
Enter the tallest tower height(m): 95
Enter the shortest tower height(m): 70
Enter the horizontal distance between the towers (m): 400
Output:
Display the result for Equal Length
Maximum sag in the conductor: 3.9062 meters
Display the result for Unequal Length
Sag at lower support (S1): 4.7310 m
Sag at upper support (S2): 29.7310 m
Clearance of lowest point from water: 65.2690 m
Experiment- 3
Aim: Write a program in MATLAB to determine the efficiency, Regulation, ABCD parameters
for short and long transmission line and verify AD-BC=1.
Tool: MATLAB
Theory:
Short transmission lines are those with a length less than 80 km (50 miles) and operating at a
voltage level below 20 kV. Due to their relatively short length and lower voltage, the effects of
line capacitance are negligible, and only the series impedance (resistance R and inductive
reactance XL) is considered in the analysis.
A long transmission line is defined as a transmission line whose length exceeds 250 km
(approximately 150 miles). For long transmission lines, the distributed nature of the line
parameters (resistance, inductance, capacitance, and conductance) must be considered, as they
significantly impact the line's performance.
Program:
Short Transmission Line
clc;
clear all;
% Input data
VL=input('Enter receiving end line voltage(VL) in V=');
S = input('Enter Total load apparent power (VA)=');
PF = input('Enter Power factor (lagging)=');
R= input('Enter Resistance of the line (R) in Ohms per phase=');
XL= input('Enter Reactance of the line (XL) in Ohms per phase =');
C=0
D=1
% verification of AD-BC=0
X=A*D-B*C
% Efficiency calculation
Ss=VS*IS';
Sr=Vr*Ir';
Efficency=(real(Sr)/real(Ss))*100
Explanation:
1. Inputs:
o Impedance per phase(Z=R+jXL).
o Sending-end voltage (Vs), Receiving-end voltage (Vr), Sending end current(Is),
Receiving-end current (Ir),
2. ABCD Parameters:
o For a short transmission line:
▪ A=D=1
▪ B=Z (series impedance)
▪ C=0 (Y is neglected)
3. Efficiency:
Efficiency=(Pr/Ps)×100
o Pr: Receiving-end power.(Real(Sr))
o Ps: Sending-end power.(Real(Ss))
4. Voltage Regulation: Voltage Regulation=(∣Vs∣−Vr)×100/Vr
Department of EEE, SJBIT Page 10
Power System Analysis-1 Lab [BEE601] 2024-25
Input:
Enter receiving end line voltage(VL) in V =11000
Enter Total apparent power (VA)=5000e3
Enter Power factor (lagging)=0.8
Enter Resistance of the line (R) in Ohms per phase =1.5
Enter Reactance of the line (XL) in Ohms per phase =4.0
Output:
A= 1
B = 1.5000 + 4.0000i
C= 0
D= 1
X= 1
Ir = 2.0995e+02 - 1.5746e+02i
VS = 7.2956e+03 + 6.0359e+02i
Voltage_Regulation = 15.2685
Efficiency = 92.8092
g=sqrt(Y*Z);
Zc=sqrt(Z/Y);
Yc=sqrt(Y/Z);
A=cosh(real(g))*cos(imag(g))+j*sinh(real(g))*sin(imag(g))
B=Zc*(sinh(real(g))*cos(imag(g))+j*cosh(real(g))*sin(imag(g)))
C=Yc*(sinh(real(g))*cos(imag(g))+j*cosh(real(g))*sin(imag(g)))
D=A
% Verification of AD-BC=1
X=A*D-B*C
% % CACULATION OF EFFICIENCY
Ss=Vs*Is';
Sr=Vr*Ir';
Efficiency=(real(Sr)/real(Ss))*100
Input:
ENTER THE LINE IMPEDANCE/phase=19.75+92.92i
ENTER THE LINE SHUNT ADMITTANCE=0.001i
ENTER THE RECEIVING END LINE VOLTAGE=138*10^3
ENTER THE RECEIVING END CURRENT=205.22-127.24i
Output:
A =0.9539 + 0.0097i
B =19.1425 +91.5518i
C =-3.2612e-006 +9.8458e-004i
D =0.9539 + 0.0097i
Regulation =22.5796
Efficiency = 94.4297
g=sqrt(Y*Z);
Zc=sqrt(Z/Y);
Yc=sqrt(Y/Z);
% Verification of AD-BC=1
X=A*D-B*C
% % CACULATION OF EFFICIENCY
Ss=Vs*Is';
Sr=Vr*Ir';
Efficiency=(real(Sr)/real(Ss))*100
Input:
Output:
A = 0.9539 + 0.0097i
B = -19.1425 -91.5518i
C = 3.2612e-006 -9.8458e-004i
D = 0.9539 + 0.0097i
X = 1.0000
Regulation = 21.2532
Efficiency = 94.8790
Experiment- 4
Aim: Write a program in MATLAB to determine the efficiency, Regulation and ABCD
parameters for medium transmission line for
i) П- configuration ii) T- Configuration and verify AD-BC=1.
Tool: MATLAB
Theory: A medium transmission line is one with a length between 80 km and 250 km,
operating at voltages from 20 kV to 100 kV. The distributed effects of resistance (R), inductance
(L), and capacitance (C) are significant but simplified using lumped parameter models like the
nominal π and T-models.
In the π-model, capacitance is split equally at both ends, while in the T-model, it is concentrated
at the center. The line parameters are represented by series impedance (Z=R+jωL) and shunt
admittance (Y=jωC). Key considerations include moderate voltage drops, charging currents, and
the Ferranti effect (voltage rise at light load). Medium lines are essential for regional power
distribution with manageable accuracy.
Program:
% Input Data
fprintf('Enter the following parameters:\n');
R= input('Resistance per phase: ');
XL= input('Reactive Inductance per phase: ');
Y= input('Shunt admitance: ')*1i;
Pload = input('Receiving-end load (MW): ')*1e6;
PF = input('Power factor (lagging, e.g., 0.9): ');
VL = input('Receiving-end voltage (V): ')*1e3;
f = 50; % Frequency in Hz
% Derived Parameters
w = 2 * pi * f; % Angular frequency
Vp = VL / sqrt(3); % Phase voltage at receiving end
Sload = Pload/PF; % Complex power at load
Ir = Pload / (sqrt(3)*VL*PF); % Receiving-end current (phasor)
Z=R+XL*1i;
Irr=abs(Ir)*(PF-(1i*sin(acos(PF))));
% For T-configuration
A_t = 1 + ((Y*Z)/2);
B_t=Z*(1+((Z*Y)/4));
C_t = Y;
D_t = A_t;
% For Π-configuration
A_pi = 1 + ((Y * Z)/2);
B_pi = Z;
C_pi = Y * (1 + ((Y * Z)/4));
D_pi = A_pi;
% Regulations for T
Vs_t = (A_t * Vp) + (B_t * Irr); % Sending-end voltage
Is_t = (C_t * Vp) + (D_t * Irr); % Sending-end current
Reg_t = ((abs(Vs_t/A_t) - abs(Vp)) / abs(Vp) * 100)
% Regulations for Pi
Vs_pi = (A_pi * Vp) + (B_pi * Irr); % Sending-end voltage
Is_pi = (C_pi * Vp) + (D_pi * Irr); % Sending-end current
Reg_pi = ((abs(Vs_pi/A_pi) - abs(Vp)) / abs(Vp) * 100)
% Efficiency for T
P_r= Vp*Ir*PF;%receiving end power
Ps_t = abs(Vs_t*Is_t);%sending end power
Eff_t = (P_r / Ps_t) * 100;
% Efficiency for Pi
P_r= Vp*Ir*PF;%receiving end power
Ps_pi = abs(Vs_pi*Is_pi);%sending end power
Eff_pi = (P_r / Ps_pi) * 100;
Input Data:
Enter the following parameters:
Resistance per phase:20
Reactive Inductance per phase:52
Shunt admitance:315
Receiving-end load (MW): 30
Power factor (lagging, e.g., 0.9): 0.85
Receiving-end voltage (V): 132
Output:
A_t = 0.9918 + 0.0031i
B_t = 19.8362 +51.8186i
C_t = 0.0000e+00 + 3.1500e-04i
D_t = 0.9918 + 0.0031i
Reg_t = 9.2541
Reg_pi = 9.3028
Eff_t = 85.2727
Eff_pi = 85.2321
Experiment- 5
Aim: Write a program in MATLAB to calculate sequence components of line voltages given the
unbalanced phase voltages.
Tool: MATLAB
Theory: The goal of this program is to calculate the sequence components of unbalanced line
voltages using the symmetrical components method. This method decomposes three-phase
unbalanced voltages into three components:
• Zero Sequence (V0): Represents the average of all three-phase voltages.
• Positive Sequence (V1): Represents a balanced set of voltages that rotate in the forward
direction.
• Negative Sequence (V2): Represents a balanced set of voltages that rotate in the reverse
direction.
Transformation Matrix for Symmetrical Components
To transform the phase voltages into their respective sequence components, we use the following
transformation matrix A, which is derived from the symmetrical component’s theory:
Program:
clc
clear all
disp('Enter the unbalanced phase voltages:');
Va = input('Va (in volts) = '); % Phase-A voltage (complex form allowed)
Vb = input('Vb (in volts) = '); % Phase-B voltage
Vc = input('Vc (in volts) = '); % Phase-C voltage
T = (1/3) *A;
Input Data:
Enter the unbalanced phase voltages:
Va (in volts) = 200+0i
Vb (in volts) = -84.52-181.26i
Vc (in volts) = -51.76+193.18i
Output:
Sequence Components of Line Voltages:
Zero Sequence Voltage (V0): 21.24 + 3.97j V
Positive Sequence Voltage (V1): 197.47 + -11.44j V
Negative Sequence Voltage (V2): -18.71 + 7.47j V
Experiment- 6
Aim: Write a program in MATLAB to calculate the sequence components of line currents,
given the unbalanced phase currents in a three phase i) 3-wire system ii) 4 wire system.
Tool: MATLAB
Theory: In a three-phase system, when phase currents are unbalanced, they can be analyzed
using symmetrical components, which decompose the unbalanced system into three balanced
sets of components: positive-sequence, negative-sequence, and zero-sequence components.
This method simplifies the analysis of unbalanced systems.
1. Positive-Sequence Components (I1): Represent a balanced three-phase system with currents
having the same magnitude and 120° phase displacement, rotating in the same direction as the
original system.
2. Negative-Sequence Components (I2): Represent a balanced three-phase system with currents
having the same magnitude and 120° phase displacement but rotating in the opposite direction
of the original system.
3. Zero-Sequence Components (I0): Represent currents that are equal in magnitude and in
phase in all three phases.
Let the unbalanced phase currents be Ia, Ib and Ic. The sequence components are calculated as:
In a 4-wire system, the neutral wire allows the zero-sequence current (I0) to flow freely, unlike a
3-wire system where I0=0.
The neutral current (In) in a three-phase 4-wire system is the current flowing through the
neutral conductor. It can be expressed as the sum of the phase currents:
In=Ia+Ib+Ic
Also, In can be calculated using, In=3I0
Program:
For 3-wire system
clc;
clear;
Input Data:
Output:
Sequence Components of Line Currents:
Zero-sequence current (I_0): 0.00 + 0.00j
Positive-sequence current (I_1): 5.00 + 2.89j
Negative-sequence current (I_2): 5.00 + -2.89j
clc;
clear;
Input Data:
or
Output:
Neutral Current:
Neutral current (In): -2.86 + 0.00j
Experiment- 7
Aim: Determine fault currents and voltages in a single transmission line for the following
unsymmetrical faults
i) Single Line to Ground Fault.
ii) Line to Line Fault
iii) Double Line to Ground Fault Using suitable
Theory: Unsymmetrical faults are disturbances in power systems where the three-phase
symmetry is disrupted, causing unbalanced conditions. These faults result in unequal fault
currents in the three phases and introduce phase shifts. They are less common than symmetrical
faults but can have more severe effects on system stability and equipment.
Types of Unsymmetrical Faults
1. Single Line-to-Ground Fault (SLG):
o Occurs when one phase conductor comes into contact with the ground or
equipment.
o Most common fault, accounting for about 70% of all power system faults.
o Example: Phase A connected to the ground.
2. Line-to-Line Fault (LL):
o Occurs when two-phase conductors come into contact with each other.
o Represents about 15% of all power system faults.
o Example: Phase A touches Phase B.
3. Double Line-to-Ground Fault (DLG):
o Occurs when two-phase conductors come into contact with the ground.
o Accounts for about 10% of all faults.
o Example: Phases A and B grounded simultaneously.
PROCEDURE:-
MiPower – Database configuration:
1. Double click on ‘MiPower’ shortcut icon on the desktop. Double click on ‘Power System
Network Editor’. A ‘Power System Network Editor’ window will appear. In its Menu bar,
select ‘Database’ and then click ‘configure’.
2. A ‘Configure Database’ window will appear. Click ‘browse’ button. An ‘Open’ window will
appear.
3. Create a new folder in any disk drives and then open that folder. Now, type ‘SCS.mdb’ as
file name and then click ‘open’.
4. The ‘Configure Database’ window will reappear with the path chosen. Now, click ‘OK’
button. A ‘Configuration Information’ window will appear now.
5. Uncheck the ‘Power System Libraries’ and ‘Standard Relay Libraries’ which are not required
for load flow analysis in pu base.
6. Click ‘Electrical & Currency Information’ in the menu bar of ‘Configuration Information’
window. In that menu, enter the given Base MVA and Base Frequency, then, check the pu
status. Now, click ‘OK’ to create the database and to return to ‘Power System Network
Editor’.
Drawing of Buses:
1. Click on ‘Bus’ icon provided on the tool bar of the power system which is situated on the
right side of ‘Power System Network Editor’. The ‘Bus Base Volt’ window will appear,
in which select the given Bus Base Voltage.
2. Draw the Bus No.1, by right clicking the mouse and dragging it to a straight line. A ‘Bus
Data’ window will appear, in which enter the Bus ID and Bus Name, then click ‘OK’.
3. A ‘BUS’ window will appear, in which enter the minimum and maximum values of Bus
Voltages (usually 5% of rated value). After entering the data, click ‘Save’ icon on this
menu bar.
4. Similarly, by following the above procedure, the remaining buses are drawn with the
given data.
Drawing of Transformers:
1. Click on ‘Two Winding Transformer’ icon provided on the tool bar of the power system
which is situated on the right side of ‘Power System Network Editor’.
2. To draw a transformer, click in between the two buses of that transformer. If the direction
of the transformer shown is correct, then connect to the FROM Bus by double clicking
LMB (Left Mouse Button) on that bus, otherwise, click ‘Object(s)’ on the menu bar, then
click ‘Rotate’ till it reaches the direction of the transformer given. Now, similarly, join the
transformer to the TO Bus by double clicking LMB on that bus.
3. An ‘Element ID’ window will appear, in which enter the Transformer Number. Now, a
‘Two Winding Transformer Data’ window will appear, in which enter the transformer’s
name, if any, and enter the ‘Manufacturer Ref. Number’ as ‘1’. Now, click ‘Transformer
Library’, a ‘Two Winding Transformer Library’ window will open.
4. Enter the given Transformer Library data for the Transformer 1 as MVA rating, primary
and secondary voltages, leakage reactances (positive and zero sequence impedance) and
winding configuration, then click ‘Save’ icon on the menu bar and click close (x).
5. The ‘Two Winding Transformer Data’ window will reappear. Now, click ‘Save’ icon on
the menu bar which invokes the ‘Power System Network Editor’.
6. Similarly, by following the above procedure, the other transformers are drawn with the
given data.
7. Take the Structure Ref. Numbers of other transformers as 2, 3, etc.
8. If any two of the transformers has same data, like, primary and secondary voltages, MVA
rating and leakage reactance, take the same ‘Structure Ref. No.’ for both transformers.
Drawing of Generators:
1. Click on ‘Generator’ icon provided on the tool bar of the power system which is situated
on the right side of ‘Power System Network Editor’.
2. Connect it to respective bus by clicking LMB on the respective bus. The ‘Element ID’
window will appear, in which, enter the generator number, and then click ‘OK’.
3. A ‘Generator Data’ window will appear, in which enter the given voltage of the
generator/bus in ‘Specified Voltage’ column in pu.
4. Now, enter ‘Manufacturer Ref. No.’ as ‘1’ and then click ‘Library’ which opens the
‘Generator Library’ window, in which, enter the MVA Rating, MW Rating, kV Rating of
the Bus/Generator and the given reactance of the Generator.
5. After entering the data, click ‘Save’ icon on the menu bar and click close (x) which will
reopen the ‘Generator Data’ window. Now, click ‘Save’ icon on the menu bar which
invokes the ‘Power System Network Editor’.
6. Similarly, by following the above procedure, the other generators are drawn with the
given data.
7. Take the Structure Ref. Numbers of other generators as 2, 3, etc.
8. If any two of the generators has given same data, take the same ‘Structure Ref. No.’ for
both generators.
1. Select ‘Solve’ on the menu bar of the ‘Power System Network Editor’, then click ‘Short
Circuit Analysis’, which opens a ‘Short Circuit Analysis’ window.
2. Now, click ‘Study Info’ on this window, then ‘Short Circuit Studies’ window will appear,
in which select ‘Fault Type’(Choose one by one SLG, LL, DLG and conduct for each
fault) and check the ‘Fault on Bus/transmission line’. Also, select the Bus Number and
Bus Name at which the fault appears, then click ‘OK’.
3. The ‘Short Circuit Analysis’ window will reappear, in which click ‘Execute’ to execute
the Short Circuit Analysis. Then, click on ‘Report’ in the ‘Short Circuit Analysis’ window
to view the report. After viewing the report, click ‘Close’ in the ‘Short Circuit Analysis’
window to end the experiment.
Example:
Figure shows a single line diagram of a 6-bus system with two identical generating units, five
lines and two transformers. Per-unit transmission line series impedances and shunt
susceptance’s are given on 100 MVA base, generator's transient impedance and transformer
leakage reactance are given in the accompanying table.
If different unsymmetrical faults occur at any transmission line - find the fault current, voltage
and fault MVA. The data is given below.
Generator details
G1 = G2 = 100 MVA, 11 kV with X'd = 10 %
Transformer details
T1 = T2 = 11/110 kV, 100 MVA, leakage reactance = x = 5 %
** All impedances are on 100 MVA base
In transmission line data, elements 3 – 4 & 5 – 6 have common parameters. Elements 3 - 5 & 4 –
6 have common parameters. Therefore 3 libraries are required for transmission line. As
generators G1 and G2 have same parameters, only one generator library is required. The same
applies for transformers also.
Open dialog box is popped up as shown below, where you are going to browse the desired
directory and specify the name of the database to be associated with the single line diagram.
Click Open button after entering the desired database name. Configure Database dialog will
appear with path chosen.
Click on OK button in the Configure database dialog, the following dialog appears.
Uncheck the Power System Libraries and Standard Relay Libraries. For this example these
standard libraries are not needed, because all the data is given on pu for power system libraries
(like transformer, line\cable, generator), and relay libraries are required only for relay co-
ordination studies. If Libraries are selected, standard libraries will be loaded along with the
Department of EEE, SJBIT Page 32
Power System Analysis-1 Lab [BEE601] 2024-25
database. Click Electrical Information tab. Since the impedances are given on 100 MVA base,
check the pu status. Enter the Base MVA and Base frequency as shown below. Click Breaker
Ratings tab. If the data is furnished, modify the breaker ratings for required voltage levels.
Otherwise accept the default values. Click OK button to create the database to return to Network
Editor. Bus Base Voltage change the Base-voltages, color, Bus width and click OK.
Procedure to Draw First Element – Bus Click on Bus icon provided on power system tool bar.
Draw a bus and a dialog appears promptingo give the Bus ID and Bus Name. Click OK. Database
manager with corresponding Bus Data form will appear. Modify the Area number, Zone number
and Contingency Weightage data if it is other than the default values. If this data is not furnished,
keep the default values. Usually the minimum and maximum voltage ratings are ± 5% of the
rated voltage. If these ratings are other than this, modify these fields. Otherwise keep the default
values.
Bus description field can be effectively used if the bus name is more than 8 characters. If bus
name is more than 8 characters, then a short name is given in the bus name field and the bus
description field can be used to abbreviate the bus name. For example let us say the bus name is
Northeast, then bus name can be given as NE and the bus description field can be North East.
After entering data click save _, which invokes Network Editor. Follow the same procedure for
remaining buses. Following table gives the data for other buses.
Click on Transmission Line icon provided on power system tool bar. To draw the line click in
between two buses and to connect to the from bus, double click LMB (Left Mouse Button) on the
From Bus and join itto another bus by double clicking the mouse button on the To Bus. Element
ID dialog will appear.
Enter Element ID number and click OK. Database manager with corresponding Line\Cable Data
form will be open.
Enter the details of that line as shown below. Enter Structure Ref No. as 1 and click on
Transmission Line Library >>button. Line & Cable Library form will appear.
Enter transmission line library data in the form as shown for Line3-4.After entering data, Save _
and Close. Line\Cable Data form will appear. Click Save _, which invokes network editor. Data
for remaining elements given in the following table. Follow the same procedure for rest of the
elements.
Click on Two Winding Transformer icon provided on power system tool bar. To draw the
transformer, click in between two buses and to connect to the from bus, double click LMB (Left
Mouse Button) on the From Bus and join it to another bus by double clicking the mouse button
on the To Bus. Element ID dialog will appear. Click OK. Transformer Element Data form will be
open. Enter the Manufacturer Ref. Number as 30. Enter transformer data in the form as shown
below. Click on Transformer Library >> button. Transformer library form will be open. Enter the
data as shown below. Save _ and close library screen.
Transformer element data form will appear. Click Save _ button, which invokes network editor.
Inthe similar way enter other transformer details.
Procedure to Draw Generator Click on Generator icon provided on power system tool bar.Draw
the generator by clicking LMB (Left Mouse Button) on the Bus1. Element ID dialog willappear.
Click OK.
Generator Data form will be opened. Enter the Manufacturer Ref. Number as 20. Enter Generator
data in the form as shown below.
Click on Generator Library >> button. Enter generator library details as shown below.Save _ and
Close the library screen. Generator data screen will be reopened. Click Save _button, which
invokes Network Editor. Connect another generator to Bus 2. Enter its details asgiven in the
following table.
Note: To neglect the transformer resistance, in the multiplication factor table give the X to R
Ratioas 9999.
TO solve short circuit studies choose menu option Solve _ Short Circuit Analysis or click onSCS
button on the toolbar on the right side of the screen. Short circuit analysis screen appears.
Result:
The fault currents and voltages in single transmission line systems with star-delta transformers at
a specified location for SLG, LL and DLG faults were determined.
Experiment- 8
Aim: Determine fault currents and voltages in a single transmission line for Three phase Fault
Theory: A three-phase fault is a type of fault in a power system where all three phases are
simultaneously short-circuited, either directly or through a low impedance. It is a symmetrical
fault, meaning the fault currents and voltages in all three phases are equal in magnitude and 120°
apart in phase angle. Although rare in occurrence (around 2–5% of faults), three-phase faults are
considered the most severe due to their high fault currents and potential to cause significant
damage to power system equipment.
Procedure:
The procedure is same as experiment 7 (instead of selecting fault type as symmetrical faults
choose three phase fault) and the power system data is same as experiment 7.
Result:
The fault currents and voltages in single transmission line systems with star-delta transformers at
a specified location for three phase fault determined.
Experiment- 9
Aim: Write a program in MATLAB to obtain critical disruptive voltage for various atmospheric
and conductor conditions.
Tool: MATLAB
Theory: The critical disruptive voltage refers to the minimum voltage at which corona
discharge begins in a transmission line under standard atmospheric conditions. Or the critical
disruptive voltage is the voltage at which the ionization of air surrounding the conductor starts,
leading to corona discharge.
This voltage is critical because it marks the onset of ionization in the surrounding air, leading to
energy loss and noise. It depends on atmospheric conditions (pressure and temperature),
conductor properties (radius, surface irregularity), and the geometry of the conductor
arrangement.
The formula used is:
Where:
• g0: Breakdown strength of air (21.1 kV/cm or 211 kV/m under standard conditions).
• δ: Air density factor, Under standard conditions, the value of δ = 1
• m0: Surface irregularity factor. (1 for polished conductors, 0·98 to 0·92 for dirty
conductors, 0·87 to 0·8 for stranded conductors)
• d: Distance between conductors (meters).
• r: Radius of the conductor (meters).
Air Density (δ):
Program:
clc;
clear;
% Inputs
r =input('Radius of the conductor in cm=');
D = input('Distance between conductors in cm=');
m0=input('enter surface irregularity factor=');
b= input('enter atmosphere pressure in cmHg=');
t= input('enter temperature in 0C=');
g0 = 21.2; % Surface dielectric strength of air in kV/cm (standard value)
Input Data:
Radius of the conductor in cm=1
Distance between conductors in cm=100
enter surface irregularity factor=0.9
enter atmosphere pressure in cmHg=76
enter temperature in K=25
Output:
delta = 0.9997
Critical Disruptive Voltage(VdL)=151.5198 kV
Experiment- 10
Aim: Write a program in MATLAB to evaluate transient stability of single machine connected
to infinite bus.
Tool: MATLAB
Theory: Transient stability of a single machine connected to an infinite bus refers to the ability
of the system to maintain synchronism after a disturbance. It is governed by the swing equation,
which relates the rotor angle δ to mechanical and electrical power. Stability is determined using
the equal-area criterion, where the accelerating and decelerating areas must balance. Key factors
influencing stability include the machine's inertia, fault clearance time, and system reactance. If
the rotor angle exceeds a critical value, the system loses synchronism.
Program:
clear
clc
H = 5; % Inertia constant (sec)
D = 0.1; % Damping factor (pu)
X_d = 1.0; % Pre-fault reactance (pu)
X_d_fault = 0.3; % Fault reactance (pu)
X_d_post = 1.0; % Post-fault reactance (pu)
P_m = 0.8; % Mechanical power (pu)
omega_s = 1; % Synchronous speed (pu)
% Initial Conditions
delta_0 = 0.2; % Initial angular displacement (rad)
omega_0 = 0; % Initial speed deviation (pu)
% Simulation Parameters
t_final = 15; % Total simulation time (sec)
dt = 1; % Time step (sec)
t_fault = 5; % Fault clearing time (sec)
t = 0:dt:t_final; % Time vector
% Initialize State Variables
delta = zeros(size(t));
omega = zeros(size(t));
delta(1) = delta_0;
omega(1) = omega_0;
% Simulation Loop
for i = 2:length(t)
if t(i) <= t_fault
X_d_current = X_d_fault; % During fault
else
if ~fault_cleared
X_d_current = X_d_post; % After fault clearing
fault_cleared = true;
end
end
subplot(3, 1, 2);
plot(t, omega, 'r', 'LineWidth', 1.5);
title('Speed Deviation (Omega) vs Time');
xlabel('Time (sec)');
ylabel('Omega (pu)');
grid on;
subplot(3, 1, 3);
plot(t, P_e_values, 'g', 'LineWidth', 1.5);
title('Electrical Power (P_e) vs Time');
xlabel('Time (sec)');
ylabel('Power (pu)');
grid on;
Explanation:
This MATLAB script simulates the dynamics of a synchronous machine using the swing
equation. It uses Euler's method for numerical integration and visualizes the angular
displacement, speed deviation, and power over time.
Output:
QUESTIONS BANK
Q.
Questions
No.
Calculate reluctance power, excitation EMF and regulation for salient and non-salient
1 pole synchronous machines. Also Write a program in MATLAB to verify the same and
draw power angle curves.
Calculate Sag of a transmission line for Poles at equal height for the data given and write
2
a program in MATLAB to verify the same.
Calculate Sag of a transmission line for Poles at unequal height for the data given and
3
write a program in MATLAB to verify the same.
Determine the efficiency, Regulation, ABCD parameters for short transmission line and
4
verify AD-BC=1. Also write a program in MATLAB to verify the same.
Determine the efficiency, Regulation, ABCD parameters for long transmission line and
5
verify AD-BC=1. Also write a program in MATLAB to verify the same.
Determine the efficiency, Regulation and ABCD parameters for medium transmission
6 line for П- configuration and verify AD-BC=1. Also write a program in MATLAB to
verify the same.
Determine the efficiency, Regulation and ABCD parameters for medium transmission
7 line for T- configuration and verify AD-BC=1. Also write a program in MATLAB to
verify the same.
Calculate sequence components of line voltages given the unbalanced phase voltages and
8
write a program in MATLAB to verify the same.
Calculate the sequence components of line currents, given the unbalanced phase currents
9
in a three phase 3-wire system and write a program in MATLAB to verify the same.
Calculate the sequence components of line currents, given the unbalanced phase currents
10
in a three phase 4 wire system and write a program in MATLAB to verify the same.
Determine of fault currents and voltages in a single transmission line for Single Line to
11
Ground Fault for the power system network given Using MiPower software package.
Determine of fault currents and voltages in a single transmission line for Line-to-Line
12
Fault for the power system network given Using MiPower software package.
Determine of fault currents and voltages in a single transmission line for Double Line to
13
Ground Fault for the power system network given Using MiPower software package.
Determine of fault currents and voltages in a single transmission line for Three-phase
14
fault on the power system network given Using MiPower software package.
Obtain critical disruptive voltage for various for different conditions and write a program
15
in MATLAB to verify the same.
Write a program in MATLAB to evaluate transient stability of single machine connected
16
to infinite bus.
Experiment 2:
The two towers of height 95m and 70m respectively support the line conductors, at a river
crossing. The horizontal distance between the towers is 400m. If the tension in the conductor is
1100 kg and its weight is 0.8kg/m, calculate a) sag at lower support b) sag at upper support c)
clearance of lowest point on trajectory from water.
Experiment 3:
Short transmission line
1. An 11 kV, 3-phase transmission line has a resistance of 1·5 Ω and reactance of 4 Ω per
phase. Calculate the percentage regulation and efficiency of the line when a total load of
5000 kVA at 0.8 lagging power factor is supplied at 11 kV at the distant end.
2. An overhead 3-phase transmission line delivers 5000 kW at 22 kV at 0·8 p.f. lagging. The
resistance and reactance of each conductor is 4 Ω and 6 Ω respectively.
Determine: (i) sending end voltage (ii) percentage regulation (iii) transmission efficiency.
Experiment 4:
A balanced 3-phase load of 30 MW is supplied at 132 kV, 50 Hz and 0·85 p.f. lagging by means
of a transmission line. The series impedance of a single conductor is (20 + j52) ohms and the total
phase-neutral admittance is 315 × 10−6 siemen. Using nominal T method, determine: (i) A, B, C
and D constants of the line (ii) Regulations (iii) Efficiency.
Experiment 5:
1. Find the positive, negative and zero sequence components for the unbalanced phase voltages
given below, Va=200 V, Vb=−84.52-j181.26 V, Vc=−51.76+j193.18 V or
2. Find the positive, negative and zero sequence components for the unbalanced phase voltages
given Va=220+0i, Vb=−100−173.2i, Vc=−105+181.9i
(Ans: V0= 5.00 + 2.90j V, V1= 210.01 + -0.01j V, V2= 4.99 + -2.89j V)
3. Find the positive, negative and zero sequence components for the unbalanced phase voltages
given Va=176-132i V, Vb=-128-96i V, Vc=-160+100i V
(Ans: V0= -37.33 + -42.67j V, V1= 163.25 + -35.43j V, V2= 50.09 + -53.90j V)
Experiment 6:
Determine the symmetrical components/sequence components of the three currents Ia=10∠00 A,
Ib=10∠2300 A and Ic=10∠1300 A.
Experiment 7:
Find the fault current, voltage and fault MVA for the power system network shown in single line
diagram below, if different unsymmetrical faults (SLG, LL, DLG) occur at the transmission line
(3-6). Per-unit transmission line series impedances and shunt susceptance’s are given on a base of
100 MVA, generator's transient impedance and transformer leakage reactance are given in the
accompanying table.
Generator details
G1 = G2 = 100 MVA, 11 kV with X'd = 10 %
Transformer details
T1 = T2 = 11/110 kV, 100 MVA, leakage reactance = x = 5 %
** All impedances are on 100 MVA base
Experiment 8:
For the power system network given in experiment 7, calculate the fault current, voltage and fault
MVA for three phase short circuit at i) bus 5 and ii) Transmission line (3-6).
Experiment 9:
A 3-phase line has conductors 2 cm in diameter spaced equilaterally 1 m apart. If the dielectric
strength of air is 30 kV (max) per cm, find the disruptive critical voltage for the line. Take
b=76cmHg, t=250C and irregularity factor mo = 0·9.
Experiment 10:
A Single Machine Infinite Bus (SMIB) system is described with the following parameters:
Inertia constant: H=5 sec
Damping factor: D=0.1 pu
Base power: Sbase=100 MVA
Synchronous speed: ωs=1 pu
Synchronous reactance: Xd=1.0 pu
Initial Conditions
Mechanical power: Pm=0.8 pu
Electrical power: Pe=0.8 pu
Initial angular displacement: δ0=0 rad
Initial speed deviation: ω0=0 pu
Using the above parameters, simulate the transient behaviour of the system.
VIVA QUESTIONS
20. What are the assumptions made for short transmission lines?
• Line capacitance is negligible.
• Only resistance and inductance are considered.
21. How is the efficiency of a transmission line calculated?
Efficiency=(Output Power/Input Power)×100
22. What methods are used to analyze medium transmission lines?
• Nominal T Method: Represents the line as a series impedance and shunt admittance
divided at the middle.
• Nominal π Method: Represents the line as a central series impedance with shunt
admittances at both ends.
23. Why is shunt capacitance considered in medium transmission lines?
For medium-length lines, the line capacitance becomes significant, affecting the voltage
regulation and charging current.
24. What is the ABCD parameter in a medium transmission line?
ABCD parameters describe the relationship between sending-end and receiving-end voltage
and current:
▪ Vs=AVr+BIr
▪ Is=CVr+Dir
• Transient Stability Limit: The maximum power transfer capability during large
disturbances.
75. What is transient stability?
Transient stability is the ability of the system to maintain synchronism when subjected to a
large disturbance, such as a short circuit or sudden load change.
76. What is the equal area criterion?
A graphical method used to determine stability by comparing the accelerating and
decelerating areas on the power-angle curve.
77. What role do automatic voltage regulators (AVRs) play in stability?
AVRs improve dynamic stability by maintaining constant voltage and supporting reactive
power during disturbances.
78. How can transient stability be improved in a power system?
• By increasing system inertia.
• Using faster circuit breakers to clear faults.
• Reducing fault clearing time.
• Using FACTS devices like SVC or STATCOM.
79. What happens if the fault clearing time is too long in an SMIB system?
The rotor angle increases excessively, causing the system to lose synchronism and become
unstable.
80. Why is the infinite bus considered to have constant voltage and frequency?
It represents a large power system with high inertia and generation capacity, making its
voltage and frequency unaffected by small disturbances.
ANNEXURE
1. Introduction to MATLAB
What is MATLAB?
• MATLAB (Matrix Laboratory) is a high-level programming language and interactive
environment for numerical computation, data analysis, and visualization.
• Common applications: Engineering, data analysis, signal processing, image processing,
and control systems.
MATLAB Environment
• Command Window: For executing commands.
• Workspace: Displays variables currently in use.
• Editor: For writing, editing, and saving scripts or functions.
• Current Folder: Shows files in the working directory.
2. MATLAB Basics
Basic Syntax
1. Variables:
o Assign variables using = (e.g., x = 10;).
o Case-sensitive (e.g., X and x are different).
o Variables are automatically stored in the workspace.
2. Data Types:
o Scalars: Single numbers (a = 5;).
o Vectors: Row (x = [1, 2, 3];) or Column (y = [1; 2; 3];).
o Matrices: 2D arrays (A = [1, 2; 3, 4];).
3. Common Commands:
o clc: Clears the command window.
o clear: Removes variables from the workspace.
o who / whos: Lists variables in the workspace.
o help <function>: Displays help for a function.
3D Plots
Mesh Plot:
[X, Y] = meshgrid(-2:0.1:2, -2:0.1:2);
Z = X.^2 + Y.^2;
mesh(X, Y, Z);
Surface Plot:
surf(X, Y, Z);
5. Programming in MATLAB
Scripts
Scripts are files containing a sequence of MATLAB commands, saved with a .m extension.
Example script (example.m):
x = 5;
y = 10;
z = x + y;
disp(z);
Functions
Functions are reusable blocks of code. Example:
function result = addNumbers(a, b)
result = a + b;
end
Save this in addNumbers.m and call it using addNumbers(5, 3).
Control Statements
Conditional Statements:
if x > 0
disp('Positive');
elseif x == 0
disp('Zero');
else
disp('Negative');
end
Loops:
For loop:
for i = 1:10
disp(i);
end
While loop:
i = 1;
while i <= 10
disp(i);
i = i + 1;
end
7. Matrix Operations:
Row Vector:
A = [1, 2, 3]; % Row vector
Column Vector:
B = [1; 2; 3]; % Column vector
Matrix:
C = [1, 2, 3; 4, 5, 6; 7, 8, 9]; % 3x3 matrix
% Define matrices
A = [1, 2; 3, 4];
B = [5, 6; 7, 8];
% Basic operations
C_add = A + B; % Addition
C_mult = A * B; % Multiplication
C_elem = A .* B; % Element-wise multiplication
8.Complex numbers
% Define complex numbers
z1 = 3 + 4i;
z2 = 2 - 5i;
% Basic operations
z_add = z1 + z2;
z_sub = z1 - z2;
z_mult = z1 * z2;
z_div = z1 / z2;
% Magnitude, phase, and conjugate
mag_z1 = abs(z1);
phase_z1 = angle(z1); % In radians
z1_conj = conj(z1);