Power Electronics Matlab

Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

Power Electronics with

Power electronics play an important role in the functioning of AC drives, semiconductors,


power supplies, converters and inverters. The aim of studying the tools and techniques
of power electronics is to obtain familiarity with advanced electronic applications and
systems. With this aim in mind, this textbook is designed specifically for undergraduate
and graduate students of electrical and electronics engineering, and electronics and
communication engineering. It presents the fundamental concepts of power electronics
including semiconductor devices, rectifiers, inverters, converters, choppers and cyclo-
converters. It provides a comprehensive discussion on power electronic drives and electrical
circuits. The latest developments including diac, diode, light-emitting diode, thyristors,
power MOSFET and static induction transistor are also discussed in detail.
The book elaborates the essential concepts with the MATLAB examples and simulations.
Plenty of applications based on MATLAB models using fuzzy logic and neural networks are
interspersed throughout the text. Numerous solved examples, practice questions, objective
type questions and review questions are provided at the end of each chapter.
The text can also serve as a reference book for researchers who need preliminary
knowledge of the design and investigation of power electronic circuits.

L. Ashok Kumar is Professor in the Department of Electrical and Electronics Engineering


at PSG College of Technology, Coimbatore. He has authored six books and has completed
sixteen Government of India funded projects and is currently working on five projects. His
areas of interest include wearable electronics, power electronics and drives, smart grids,
solar PV and wind energy systems.

A. Kalaiarasi is Assistant Professor in the Department of Electrical and Electronics


Engineering, RVS College of Engineering and Technology, Coimbatore. Her areas of
interest are medical instrumentation, power electronics and drives, big data analytics,
embedded system technologies and industrial automation.

Y. Uma Maheswari is Technology Manager at Pramura Software Private Limited,


Coimbatore. She has around fifteen years of industrial experience. Her expertise is in PCB
designing and simulation software.
Power Electronics with

L. Ashok Kumar
A. Kalaiarasi
Y. Uma Maheswari
University Printing House, Cambridge cb2 8bs, United Kingdom
One Liberty Plaza, 20th Floor, New York, ny 10006, USA
477 Williamstown Road, Port Melbourne, vic 3207, Australia
314 to 321, 3rd Floor, Plot No.3, Splendor Forum, Jasola District Centre, New Delhi 110025, India
79 Anson Road, #06–04/06, Singapore 079906

Cambridge University Press is part of the University of Cambridge.


It furthers the University’s mission by disseminating knowledge in the pursuit of
education, learning and research at the highest international levels of excellence.

www.cambridge.org
Information on this title: www.cambridge.org/9781316642313
© Cambridge University Press 2018
This publication is in copyright. Subject to statutory exception
and to the provisions of relevant collective licensing agreements,
no reproduction of any part may take place without the written
permission of Cambridge University Press.
First published 2018
Printed in India
A catalogue record for this publication is available from the British Library
ISBN 978-1-316-64231-3 Paperback
Additional resources for this publication at www.cambridge.org/9781316642313

Cambridge University Press has no responsibility for the persistence or accuracy


of URLs for external or third-party internet websites referred to in this publication,
and does not guarantee that any content on such websites is, or will remain,
accurate or appropriate.

MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. The MathWorks Publisher Logo
identifies books that contain “MATLAB®” and “Simulink®” content. Used with permission.
The MathWorks does not warrant the accuracy of the text or exercises in this book. This book’s use or discussion of
“MATLAB®” and/or “Simulink®” software or related products does not constitute endorsement or sponsorship by
The MathWorks of a particular use of the “MATLAB®” and/or “Simulink®” software or related products.
To our families
Contents

Figures xv
Tables xxv
Acknowledgements xxvii
Preface xxix
1. Introduction to MATLAB
1.1 Introduction and Outlook 1
1.2 How to Start with MATLAB? 2
1.2.1 Installing and activation 3
1.3 MATLAB: A Calculator 4
1.3.1 Basic arithmetic operations 5
1.3.2 Assigning values to variables 6
1.4 Basic Features of MATLAB 10
1.4.1 Investigation of a MATLAB function 10
1.4.2 Mathematical functions 10
1.4.3 Vector and matrix operations 12
1.4.4 Arrays 21
1.4.5 Basic plotting 24
1.5 Programming with MATLAB 26
1.5.1 Creating M-files 26
1.5.2 M-file functions 27
1.5.3 Control structures and operators 28
1.5.4 Debugging M-files 31
1.5.5 Creating plots 32
viii Contents

1.6 Circuit Descriptions 33


1.6.1 Format and layout 33
1.6.2 Electrical circuit description 34
1.6.3 Simulink library browser 34
1.6.4 Circuit elements 39
1.6.5 DC analysis 41
1.6.6 AC analysis 42
1.7 Examples of MATLAB Simulations 45
1.7.1 Steady state analysis of a linear circuit 45
1.7.2 Resonant switch converter using metal oxide semiconductor field effect
transistor (MOSFET) 46
1.7.3 Gate turn off (GTO) thyristor-based converter 47
1.7.4 Regulation of zener diode 49
1.7.5 Regulation of pulse generator using thyristor converter 50
1.8 Other Types Circuit Simulators 52
1.8.1 PSpice 52
1.8.2 LabVIEW 52
1.8.3 PSIM 52
1.8.4 Scilab 53
1.8.5 VisSim 53
1.9 Merits and Demerits of MATLAB 54
1.9.1 Merits 54
1.9.2 Demerits 54
Summary 54
Review Questions 54
Practice Questions 55
Multiple Choice Questions 57

2. MATLAB Simulation of Power Semiconductor Devices


2.1 Introduction and Outlook 60
2.2 Why is Power Electronics Important? 61
2.3 Features of Power Electronics 61
2.4 Applications of Power Electronics 63
2.5 Power Semiconductor Devices in MATLAB/Simulink 64
2.5.1 Power diode and its characteristics 66
2.5.2 Zener diode 73
2.5.3 Fast recovery diode 75
2.5.4 Thyristors 76
2.5.5 Power MOSFET 100
Contents ix

2.5.6 Gate turn off thyristors 102


2.5.7 Insulated-gate bipolar transistor (IGBT) 105
2.6 Other Semiconductor Devices 107
2.6.1 DIAC 107
2.6.2 TRIAC 107
2.6.3 MOS controlled thyristor 108
2.6.4 Integrated gate-commutated thyristors 108
2.7 MATLAB/Simulink Model of Semiconductor Devices in Electronics 109
2.7.1 Schottky diode 109
2.7.2 Bipolar junction transistors 111
2.7.3 MOSFET 113
2.7.4 IGBT 114
2.8 Gate Triggering Methods 116
2.8.1 Resistance firing circuit 116
2.8.2 Resistance–capacitance firing circuit 117
2.8.3 UJT firing circuit 118
2.8.4 Pulse transformers 119
2.8.5 Optocoupler 119
2.8.6 Ramp-pedestrial triggering 120
2.9 Comparison of Power Semiconductor Devices with Industry Applications 120
2.9.1 Other devices 122
Summary 125
Solved Examples 125
Practice Questions 141
Review Questions 142
Multiple Choice Questions 143

3. Phase-Controlled Rectifiers Using MATLAB (AC–DC Converters)


3.1 Introduction 146
3.2 Rectification and Its Classification 147
3.2.1 Based on control characteristics 147
3.2.2 Based on period of conduction 152
3.2.3 Based on number of phases 153
3.2.4 Based on number of pulses 153
3.3 Selection of Components from the Simulink Library Browser 153
3.4 One Pulse Converters 155
3.4.1 Single-phase half-wave-controlled rectifiers 155
3.5 Two Pulse Converters 163
x Contents

3.5.1 Single-phase full-wave bridge rectifiers 163


3.5.2 Single-phase midpoint bridge rectifiers 169
3.5.3 Single-phase semiconverter half-controlled bridge rectifiers 173
3.6 Three Pulse Converters 178
3.6.1 Three-phase half-wave-controlled rectifiers 178
3.6.2 Three-phase half-controlled bridge rectifier with RL load 181
3.7 Six Pulse Converters 183
3.7.1 Six pulse converter with R load 183
3.7.2 Six pulse converter with RL load 186
3.8 Dual Converter 187
3.9 Role of Source Inductance in Rectifier Circuits (Ls) 188
3.10 Applications of Controlled Rectifiers 189
Summary 189
Solved Examples 189
Objective Type Questions 200
Review Questions 203
Practice Questions 204

4. DC Choppers Using MATLAB (DC–DC Converters)


4.1 Introduction 206
4.2 Choppers and their Classification 207
4.3 Control Strategies of Chopper 208
4.3.1 Pulse width modulation or constant frequency system 208
4.3.2 Variable frequency control or frequency modulation 208
4.3.3 Current limit control 209
4.4 Selection of Components from the Simulink Library Browser 209
4.5 Principle of Operation of a Step-down Chopper 211
4.6 Principle of Operation of a Step-up Chopper 212
4.7 Performance Parameters of Step-up and Step-down Choppers 213
4.8 Chopper Configuration 215
4.8.1 Type A chopper 216
4.8.2 Type B chopper 217
4.8.3 Type C chopper (regenerative chopper) 220
4.8.4 Type D chopper 222
4.8.5 Type E chopper 224
4.9 Switching Mode Regulators 226
4.9.1 Buck converter 226
4.9.2 Boost converter 228
4.9.3 Buck–boost converter 230
Contents xi

4.9.4 Cuk converter 231


4.10 Chopper Commutation 231
4.10.1 Voltage-commutated chopper 231
4.10.2 Current-commutated chopper 234
4.10.3 Load-commutated chopper 236
4.11 Jones Chopper 237
4.12 Morgan Chopper 238
4.13 AC Choppers 239
4.14 Source Filter 239
4.15 Multiphase Chopper 240
4.16 Applications of Choppers 240
Summary 241
Solved Problems 241
Objective Type Questions 251
Review Questions 253
Practice Questions 254

5. Inverters Using MATLAB (DC–DC Converters)


5.1 Introduction 256
5.2 Inverters and their Classification 257
5.2.1 Classification based on input source 257
5.2.2 Classification based on output voltage 257
5.2.3 Classification based on technique for substitution 258
5.2.4 Classification based on associations with other devices 258
5.3 Selection of Components from Simulink Library Browser 258
5.4 Voltage Source Inverters 260
5.4.1 Single-phase voltage source inverters 260
5.5 Performance Parameters of Inverters 265
5.6 McMurray Inverter (Auxiliary-Commutated Inverter) 266
5.7 Modified McMurray Half-Bridge and Full-Bridge Inverter 267
5.7.1 Modified McMurray half-bridge inverter 269
5.7.2 Modified McMurray full-bridge inverter 270
5.8 PWM Inverters 270
5.8.1 Single pulse width modulation 271
5.8.2 Multiple pulse width modulation 271
5.9 Three-Phase Bridge Inverter 273
5.9.1 180° Conduction mode 273
5.9.2 120° Conduction mode 274
5.10 Current Source Inverters 275
xii Contents

5.10.1 Single-phase capacitor-commutated current source inverter with R load 275


5.11 Resonant Converters 277
5.11.1 Series resonant converters 277
5.11.2 Parallel resonant converters 279
5.11.3 ZVS and ZCS PWM converters 280
5.12 Applications of Inverters 280
Summary 281
Solved Problems 281
Objective Type Questions 283
Review Questions 288
Practice Questions 288

6. Controllers Using MATLAB (AC–AC Converters)


6.1 Introduction 290
6.1.1 ON–OFF control 291
6.1.2 Phase control 291
6.2 Classification of AC Voltage Controllers 291
6.3 Single-Phase AC Voltage Controllers 292
6.3.1 Single-phase half-wave AC voltage controller with R load 293
6.3.2 Single-phase full-wave AC voltage controller with R load 296
6.3.3 Single-phase full-wave AC voltage controller with RL load 299
6.4 Cycloconverters and Its Types 302
6.4.1 Single-phase cycloconverters 303
6.4.2 Three-phase cycloconverters 307
6.5 Load-Commutated Cycloconverter 317
6.6 Matrix Converter 317
6.7 Applications of Voltage Controllers 319
Summary 319
Solved Problems 319
Objective Type Questions 334
Review Questions 336
Practice Questions 337

7. Simulation and Digital Control Using MATLAB


7.1 Introduction 339
7.2 Fuzzy Logic Principles 341
7.2.1 Fuzzy logic tool box 341
7.2.2 Implementation 346
Contents xiii

7.2.3 Description and design of FLC 347


7.2.4 Simulation and results 350
7.3 Neural Network Principles 352
7.3.1 Background of neural networks 353
7.3.2 Implementation 355
7.3.3 Algorithm for ANN 357
7.3.4 Simulation results 359
7.4 Converter Control Using Microprocessors and Microcontrollers 362
Summary 363
Solved Examples 363
Practice Questions 366
Review Questions 367
Multiple Choice Questions 367

8. Power Electronics Applications


8.1 Introduction 372
8.2 Uninterruptible Power Supply (UPS) 373
8.2.1 Static systems 373
8.3 Switch-Mode Power Supply 377
8.3.1 Forward-mode SMPS 378
8.3.2 Flyback-mode SMPS 378
8.4 High-Voltage DC Transmission 380
8.5 VAR Compensators 380
8.6 Battery Charger 382
8.7 Switch-Mode Welding 383
8.8 RF Heating 383
8.9 Electronic Ballast 383
8.9.1 Characteristics of fluorescent lamps 383
8.10 Brushless DC (BLDC) Motors 384
8.11 Thermal Management and Heat Sinks 385
Summary 385
Multiple Choice Questions 385
Review Questions 387
Practice Questions 387

9. Introduction to Electrical Drives


9.1 Introduction 388
9.1.1 Merits and demerits of electrical drive systems 389
9.2 DC Drives 390
xiv Contents

9.2.1 Steady-state operation of a separately excited DC motor 390


9.2.2 Four quadrant operation 394
9.2.3 Single-phase and three-phase DC drive 396
9.2.4 Reversal of DC motor 401
9.2.5 DC chopper drives 402
9.3 AC Drives 404
9.3.1 Induction motor drive 404
9.4 Synchronous Motor Drive 409
9.5 Phase-Locked Loop (PLL) 411
Summary 411
Solved Problems 411
Objective Type Questions 414
Review Questions 417
Practice Questions 418

Appendix 1 Block Parameter Settings 419


Appendix 2 List of MATLAB Projects 422
Appendix 3 MATLAB Functions 432
Appendix 4 Useful Formulae 441
Appendix 5 Table of Laplace and Z Transforms 474
Appendix 6 Gate Questions 478
Resources for MATLAB 511
Index 513
Figures

1.1 Startup Page of MATLAB. 4


1.2 MATLAB as a Calculator. 7
1.3 Working with Variables. 8
1.4 Basic Plotting 1. 24
1.5 Basic Plotting 2. 25
1.6 Plot with Label and Annotation. 26
1.7 Editor Window. 27
1.8 Plotting. 32
1.9 Simulink Library Browser. 34
1.10 Electrical Sources. 35
1.11 Measurement. 36
1.12 Elements. 36
1.13 Commonly Used Blocks. 37
1.14 Simple Electrical Circuit. 37
1.15 Parameters. 38
1.16 Circuit Elements. 39
1.17 Passive Elements. 40
1.18 DC Analysis. 41
1.19 Simulink Model. 42
1.20 AC Analysis. 42
1.21 Simulink Model. 44
1.22 Scope Output. 44
1.23 Steady State Analysis of a Linear Circuit with RLC. 45
1.24 Scope Output for Steady State Analysis of a Linear Circuit. 46
xvi Figures

1.25 Resonant Switch Converter using MOSFET. 46


1.26 Scope Output of Resonant Switch Converter Using MOSFET. 47
1.27 GTO-based Converter. 48
1.28 Scope Output of GTO-based Converter. 48
1.29 Regulation of Zener Diode. 49
1.30 Scope Output of Regulation of Zener Diode. 50
1.31 Regulation of Pulse Generator Using Thyristor Converter. 51
1.32 Scope Output of Regulation of Pulse Generator Using Thyristor Converter. 51
2.1 Basic Block Diagram of a Power Electronic System. 62
2.2 Power Semiconductor Devices. 65
2.3 Symbol of Diode. 66
2.4 Schematic Representation of a Diode Circuit. 66
2.5 Reverse Leakage Current. 66
2.6 Diode On and Off Characteristics. 67
2.7 Reverse Recovery Characteristics. 68
2.8 Simulink Model of a Diode (Forward Bias). 68
2.9 Parameters of a Diode. 70
2.10 Switching Waveform of a Diode (Forward Bias). 70
2.11 V–I Characteristics of a Diode (Forward Bias). 71
2.12 Simulink Model of a Diode (Reverse Bias). 72
2.13 Switching Waveform of a Diode (Reverse Bias). 72
2.14 V–I Characteristics of a Diode (Reverse Bias). 73
2.15 Symbol of a Zener Diode. 73
2.16 Simulink Model of a Zener Diode. 74
2.17 Switching Waveforms of a Zener Diode. 75
2.18 Symbol of an SCR. 76
2.19 Structure of an SCR. 77
2.20 V–I characteristics of an SCR. 78
2.21 Simulink Model of a Thyristor (Forward Bias). 79
2.22 Switching Waveform of a Thyristor (Forward Bias). 80
2.23 Simulink Model of a Thyristor (Reverse Bias). 81
2.24 Switching Waveform of a Thyristor (Reverse Bias). 81
2.25 Effect of Holding Current and Latching Current. 82
2.26 Gate Characteristics. 82
2.27 dI/dt Protection. 84
2.28 dV/dt Protection. 84
2.29 Turn on of Thyristor. 85
2.30 Turn off of Thyristor. 86
2.31 Off State Characteristics of Two Thyristors of the Same Type. 87
Figures xvii

2.32 Series Operation of Thyristors. 88


2.33 Equal Voltage Sharing. 88
2.34 Voltage Sharing and Reverse Recovery Time. 90
2.35 Characteristics of Two Parallel Thyristors. 91
2.36 Parallel Operation of Thyristors. 91
2.37 Two-transistor Model of Thyristor. 92
2.38 Natural Commutation. 96
2.39 Class A Commutation. 97
2.40 Class B Commutation. 97
2.41 Class C Commutation. 98
2.42 Class D Commutation. 98
2.43 Class E Commutation. 99
2.44 Symbol of MOSFET. 100
2.45 Simulink Model of MOSFET. 101
2.46 Switching Waveforms of MOSFET. 102
2.47 Symbol of GTO. 103
2.48 Simulink Model of a GTO. 104
2.49 Switching Waveform of GTO. 104
2.50 Symbol of IGBT. 105
2.51 Simulink Model of an IGBT. 106
2.52 Switching Waveforms of IGBT. 107
2.53 Symbol of DIAC. 107
2.54 Symbol of TRIAC. 108
2.55 Symbol of MCT. 108
2.56 Symbol of IGCT. 108
2.57 Symbol of a Schottky Diode. 109
2.58 Model of a Schottky Diode. 110
2.59 Block Parameter of a Schottky Diode. 110
2.60 I–V Plot (Schottky Diode). 111
2.61 Symbol of BJT. 111
2.62 Simulink Model of a PNP Transistor. 112
2.63 Simulink Model of an NPN Transistor. 112
2.64 Switching Characteristics of a Transistor. 113
2.65 Simulink Model of N Channel MOSFET. 113
2.66 Switching Characteristics of MOSFET. 114
2.67 Simulink Model of N Channel IGBT. 115
2.68 Switching Characteristics of IGBT. 115
2.69 Resistance Firing Circuits. 116
2.70 Waveform of Resistance Firing Circuits. 116
xviii Figures

2.71 Resistance–Capacitance Firing Circuit. 117


2.72 Waveform of a Resistance–Capacitance Firing Circuit. 117
2.73 UJT Firing Circuit. 118
2.74 Waveform of UJT Firing Circuit. 118
2.75 Pulse Transformer. 119
2.76 Optocoupler. 119
2.77 Ramp-Pedestrial Triggering Circuit. 120
3.1 Simulation Model of a Half-Wave Diode Rectifier with R Load. 148
3.2 Output Waveforms for a Half-Wave Diode Rectifier with R Load. 149
3.3 Simulation Model of a Center Taped and Bridge Rectifier. 150
3.4 Simulation Results of a Center Taped Rectifier. 150
3.5 Simulation Model of a Single-Phase Full-Wave Bridge Rectifier with R Load. 151
3.6 Simulation Results of a Full-Wave Bridge Rectifier. 152
3.7 Simulation Model of a Single-Phase Half-Wave-Controlled Rectifier with R Load. 156
3.8 Simulation Waveform of a Single-Phase Half-Wave-Controlled Rectifier with R
Load. 156
3.9 Simulation Model of a Single-Phase Half-Wave-Controlled Rectifier with RL Load. 158
3.10 Single-Phase Half-Wave-Controlled Rectifier with RL Load. 159
3.11 Single-Phase Half-Wave-Controlled Rectifier with RL Load and Freewheeling
Diode. 160
3.12 Switching Waveforms of a Single-Phase Half-Wave-Controlled Rectifier with RL
Load and Freewheeling Diode. 161
3.13 Single-Phase Half-Wave-Controlled Rectifier with RLE Load. 162
3.14 Switching Waveforms of a Single-Phase Half-Wave-Controlled Rectifier with RLE
Load. 163
3.15 Simulink Model of Single-Phase Full-Wave Bridge Rectifier with R Load. 164
3.16 Switching Waveforms of a Single-Phase Full-Wave Bridge Rectifier with R Load. 165
3.17 Simulink Model of a Single-Phase Full-Wave Bridge Rectifier with RL Load. 166
3.18 Switching Waveforms of a Single-Phase Full-Wave Bridge Rectifier with RL Load. 167
3.19 Simulink Model of a Single-Phase Full-Wave Bridge Rectifier with RLE Load. 168
3.20 Switching Waveforms of a Single-Phase Full-Wave Bridge Rectifier with RLE Load. 168
3.21 Simulink Model of a Single-Phase Midpoint Bridge Rectifier with R Load. 169
3.22 Switching Waveform of a Single-Phase Midpoint Bridge Rectifier with R Load. 170
3.23 Simulink Model of a Single-Phase Midpoint Bridge Rectifier with RL Load. 171
3.24 Switching Waveforms of a Single-Phase Midpoint Bridge Rectifier with RL Load. 172
3.25 Simulink Model of a Single-Phase Midpoint Bridge Rectifier with Freewheeling
Diode. 172
3.26 Switching Waveforms of a Single-Phase Midpoint Bridge Rectifier with
Freewheeling Diode. 173
Figures xix

3.27 Simulink Model of a Single-Phase Semiconverter Half-Controlled Bridge Rectifier


with R Load. 174
3.28 Switching Waveforms of a Single-Phase Semiconverter Half-Controlled Bridge
Rectifier with R Load. 174
3.29 Simulink Model of a Single-Phase Semiconverter Half-Controlled Bridge Rectifier
with RL Load. 176
3.30 Switching Waveforms of a Single-Phase Semiconverter Half-Controlled Bridge
Rectifier with RL Load. 176
3.31 Simulink Model of a Single-Phase Semiconverter Half-Controlled Bridge Rectifier
with RLE Load. 177
3.32 Switching Waveforms of a Single-Phase Semiconverter Half-Controlled Bridge
Rectifier with RLE Load. 177
3.33 Simulink Model of a Three-Phase Half-Wave-Controlled Rectifier with R Load. 178
3.34 Switching Waveforms of a Three-Phase Half-Wave-Controlled Rectifier with R
Load. 179
3.35 Simulink Model of a Three-Phase Half-Wave-Controlled Rectifier with RL Load. 180
3.36 Switching Waveforms of Three-Phase Half-Wave-Controlled Rectifier with RL
Load. 180
3.37 Simulink Model of a Three-Phase Half-Controlled Bridge Rectifier with RL Load. 181
3.38 Switching Waveforms for Continuous Conduction Mode, α = 30°. 182
3.39 Switching Waveforms for Discontinuous Conduction Mode, α = 90°. 183
3.40 Simulink Model of a Six Pulse Rectifier with R Load. 184
3.41 Pulse Generator Waveform. 185
3.42 Switching Waveforms for a Six Pulse Converter with R Load. 185
3.43 Simulink Model of a Six Pulse Rectifier with RL Load. 186
3.44 Pulse Generator Waveforms. 187
3.45 Switching Waveforms Model of a Six Pulse Rectifier with RL Load. 187
3.46 Dual Converter. 188
4.1 Principle of Pulse Width Modulation System. 208
4.2 Principle of Variable Frequency Control. 209
4.3 Operation of Step-down Chopper with R Load. 211
4.4 Step-down Chopper Circuit with RLE Load. 212
4.5 Step-up Chopper Circuit. 212
4.6 Type A Chopper. 216
4.7 Performance of Type A Chopper. 216
4.8 Simulation Model of a Type A Chopper. 217
4.9 Simulation Waveform of a Type A Chopper. 217
4.10 Type B Chopper. 218
4.11 Performance of a Type B Chopper. 218
4.12 Simulation Model of a Type B Chopper. 219
xx Figures

4.13 Simulation Waveform of a Type B Chopper. 219


4.14 Type C Chopper. 220
4.15 Performance of a Type C Chopper. 220
4.16 MATLAB/Simulink Model of a Type C Chopper. 221
4.17 Simulation Waveform of a Type C Chopper. 222
4.18 Type D Chopper. 222
4.19 Performance of a Type D Chopper. 223
4.20 MATLAB/Simulink Model of a Type D Chopper. 223
4.21 Simulation Waveform of a Type D Chopper. 224
4.22 Type E Chopper. 224
4.23 MATLAB/Simulink Model of a Type E Chopper. 225
4.24 Simulation Waveform of a Type E Chopper. 226
4.25 MATLAB/Simulink Model of a Buck Converter. 227
4.26 Simulation Waveform of a Buck Converter. 227
4.27 MATLAB/Simulink Model of a Boost Converter. 228
4.28 Simulation Waveform of a Boost Converter. 229
4.29 MATLAB/Simulink Model of a Buck–Boost Converter. 230
4.30 Simulation Waveform of a Buck–Boost Converter. 231
4.31 MATLAB/Simulink Model of a Voltage-Commutated Chopper. 232
4.32 Simulation Waveform of a Voltage-Commutated Chopper. 233
4.33 MATLAB/Simulink Model of a Current-Commutated Chopper. 235
4.34 Simulation Waveform of a Current-Commutated Chopper. 236
4.35 Simulation Model of a Load-Commutated Chopper. 237
4.36 Simulation Waveform of a Load-Commutated Chopper. 237
4.37 Jones Chopper Circuit. 238
4.38 Morgan Chopper. 239
S1 DC-DC converter 246
S2 A Synchronous Buck Converter. 248
S3 DC-DC converter 249
5.1 Simulation Diagram of a Single-Phase Half-Bridge Inverter with R Load. 261
5.2 Simulation Waveform for a Single-Phase Half-Bridge Inverter with R Load. 262
5.3 Simulation Model of a Single-Phase Full-Bridge Inverter with R Load. 262
5.4 Simulation Waveform of a Single-Phase Full-Bridge Inverter with R Load. 263
5.5 Simulation Model of a Single-Phase Half-Bridge Inverter with RL Load. 264
5.6 Simulation Waveform of a Single-Phase Half-Bridge Inverter with RL Load. 265
5.7 Simulation Model of a McMurray Auxiliary Commutated Inverter. 266
5.8 Simulation Waveform of McMurray Auxiliary Commutated Inverter. 267
5.9 Simulation Model of a Modified McMurray Half-Bridge Inverter. 268
5.10 Simulation Waveform of Modified McMurray Full-Bridge Inverter. 268
Figures xxi

5.11 Simulation Waveform of a Modified McMurray Half-Bridge Inverter. 269


5.12 Simulation Waveform of a Modified McMurray Full-Bridge Inverter. 270
5.13 Pulse Width Modulation. 272
5.14 Pulse Width Modulation with Reference Signal. 272
5.15 Simulation Model of a Three-Phase Bridge Inverter. 273
5.16 Simulation Model of Three-Phase Bridge Inverter 180° Conduction. 274
5.17 Simulation Model of Three-Phase Bridge Inverter 120° Conduction. 274
5.18 Simulation Model of a Single-Phase Capacitor-Commutated Current Source
Inverter with R Load. 276
5.19 Simulation Waveform for a Single-Phase Capacitor-Commutated Current Source
Inverter with R Load. 277
5.20 Simulation Model of a Series Resonant Inverter. 278
5.21 Simulation Waveform of a Series Resonant Inverter. 279
5.22 Parallel Resonant Inverter. 279
5.23 ZVS and ZCS-PWM Converters. 280
6.1 Circuit of a Single-Phase Half-Wave AC Voltage Controller with R Load. 292
6.2 Waveform of a Single-Phase Half-Wave AC Voltage Controller. 294
6.3 MATLAB Model of a Single-Phase Half-Wave AC Voltage Controller with R Load. 295
6.4 Simulation Waveform of a Single-Phase Half-Wave AC Voltage Controller with R
Load. 296
6.5 Circuit of a Single-Phase Full-Wave AC Voltage Controller with R Load. 297
6.6 Waveform of a Single-Phase Full-Wave AC Voltage Controller with R Load. 297
6.7 MATLAB Model of Single-Phase Full-Wave AC Voltage Controller with R Load. 298
6.8 Simulation Waveform of a Single-Phase Full-Wave AC Voltage Controller with R
Load. 299
6.9 Circuit of a Single-Phase Full-Wave AC Voltage Controller with RL Load. 299
6.10 Waveform of a Single-Phase Full-Wave AC Voltage Controller with RL Load. 300
6.11 MATLAB Model of a Single-Phase Full-Wave AC Voltage Controller with RL
Load. 301
6.12 Simulation Waveform of a Single-Phase Full-Wave AC Voltage Controller with
RL Load. 302
6.13 Single-Phase Cycloconverter. 303
6.14 Waveform of a Single-Phase to Single-Phase Cycloconverter. 304
6.15 MATLAB Model of a Single-Phase to Single-Phase Cycloconverter. 305
6.16 Simulation Waveform of a Single-Phase to Single-Phase Step-Up Cycloconverter. 306
6.17 Simulation Waveform of a Single-Phase to Single-Phase Step-Down
Cycloconverter. 306
6.18 3Φ–1Φ Half-Wave Cycloconverter. 307
6.19 3Φ–1Φ Bridge Cycloconverter. 308
6.20 Waveforms of 3Φ–1Φ Cycloconverter. 308
xxii Figures

6.21 MATLAB Model of a Three-Phase to Single-Phase Cycloconverter. 310


6.22 Simulation Waveform of a Three-Phase to Single-Phase Cycloconverter. 310
6.23 3Φ–3Φ Half-Wave Cycloconverter. 311
6.24 3Φ–3Φ Bridge Cycloconverter. 312
6.25 Noncirculating Mode. 314
6.26 Circulating Mode. 315
6.27 MATLAB model of a Three-Phase to Three-Phase Cycloconverter. 316
6.28 Simulation Waveform of a Three-Phase to Three-Phase Cycloconverter. 317
6.29 Schematic of Matrix Converter. 318
7.1 Fuzzy Logic Toolbox. 342
7.2 FIS Editor. 343
7.3 Membership Function. 343
7.4 Rule Editor. 344
7.5 Rule Viewer. 344
7.6 Surface Viewer. 345
7.7 Membership Function for Input and Output of FLC. 345
7.8 Block Diagram of the Buck Converter. 347
7.9 Block Diagram of the FLC. 348
7.10 Membership Functions for the Fuzzy Model (a) Input DPpv, (b) Input DVpv, and
(c) Output DVref. 349
7.11 FLC Simulink Model. 351
7.12 PV Source Block. 351
7.13 Subsystem Block. 352
7.14 Power Characteristic Curve with FLC. 352
7.15 Overview of Neural Network. 353
7.16 A Simple Neuron. 354
7.17 A Basic Artificial Neuron. 354
7.18 Basic Structure of a Neural Network. 355
7.19 Overall Simulink Model. 358
7.20 Structure of the Neural Network. 358
7.21 Structure of the First Layer of Neural Network. 359
7.22 Structure of the Second Layer of Neural Network. 359
7.23 Training Curve. 360
7.24 Voltage Curve for Neural Network. 361
7.25 Current Curve for Neural Network. 361
7.26 Power Curve for Neural Network. 362
8.1 Block Diagram of Offline UPS. 374
8.2 Block Diagram of Online UPS. 375
8.3 Block Diagram of Line Interactive UPS. 376
Figures xxiii

8.4 Forward-Mode SMPS. 378


8.5 Flyback-Mode SMPS. 379
8.6 VAR Compensators. 381
9.1 Basic Block Diagram of an Electrical Drive System. 389
9.2 Separately Excited DC Motor. 390
9.3 Steady State Operation of a DC Motor. 393
9.4 Speed–Torque Curve. 394
9.5 Four Quadrant Operation of a DC Motor. 395
9.6 Basic Thyristor-Based Drive. 396
9.7 Single-Phase DC Drive. 397
9.8 Three-Phase DC Drive. 398
9.9 Simulation Model of a Single-Phase DC Drive. 398
9.10 Speed–Torque Curves of a Single-Phase DC Drive. 399
9.11 Output Waveform of a Single-Phase DC Drive. 399
9.12 Simulation Model of a Three-Phase DC Drive. 400
9.13 Output Waveform of a Three-Phase AC Drive. 400
9.14 Speed–Torque Curves of a Three-Phase DC Drive. 401
9.15 Concept of Reversal. 401
9.16 DC–DC Chopper Drive. 402
9.17 Chopper-Fed Drive. 403
9.18 Speed–Torque Characteristics. 403
9.19 Speed–Torque Characteristics of an Induction Motor. 405
9.20 Induction Motor Drive. 406
9.21 VSI-Fed Induction Motor. 407
9.22 Induction Motor Drive. 408
9.23 Simulink Model of a Synchronous Motor-Fed Drive. 409
9.24 Waveform of a Synchronous Motor-Fed Drive. 410
9.25 Speed–Torque Characteristics of a Synchronous Motor-Fed Drive. 410
Tables

1.1 Installing and activating using an Internet connection 3


1.2 Installing and activating without using an Internet connection 3
1.3 Array Functions 24
1.4 Simulink Features 33
2.1 Power Electronic Converters 64
2.2 Characteristics of Various Types of Diodes 76
2.3 Applications of Power Semiconductor Devices 121
2.4 Power Electronic Systems 124
4.1 Features of Step-down and Step-up Choppers 215
7.1 Fuzzy Rule Base Table 346
7.2 Rule Base for the Fuzzy Model 349
7.3 Training Data 359
7.4 Results of ANN 360
Acknowledgements

The authors are thankful to the Almighty for giving them the strength to persevere and for
their achievements.
The authors owe gratitude to Shri L Gopalakrishnan, Managing Trustee, PSG Institutions,
Dr K. V. Kuppusamy, Managing Trustee, RVS Institutions, Dr R. Rudramoorthy, Principal,
PSG College of Technology, Coimbatore, India and Dr V. Gunaraj, Principal, RVS College
of Engineering and Technology, Coimbatore for their whole-hearted cooperation and
encouragement for this successful endeavor.
Dr L. Ashok Kumar takes this opportunity to acknowledge many people who helped
him in completing this book. This book would not have come to its completion without the
help of my students, my department staff and my institute, and especially my project staff. I
am thankful to all my students doing their projects and research work with me. The writing
of this book would have been impossible without the support of my family members;
parents and sisters. Most importantly, I am very grateful to my wife, Y. Uma Maheswari,
for her constant support during the writing: without her nothing would have been possible.
I would like to express my special gratitude to my daughter A. K. Sangamithra for her
smiling face and support, which helped a lot in completing this work.
Professor A. Kalaiarasi would like to acknowledge her deep sense of gratitude to
her family, specially her daughter V. K. Meha for the patience and endless support in
completing this book. Most importantly, I take this opportunity to thank my supervisor
Dr L. Ashok Kumar for giving me a chance to work on this writing alongside him. This
acknowledgment would not be complete without expressing my gratitude to my friends
and students for their constant support.
We thank the personnel at Cambridge University Press, who produced the book. In
addition, special thanks to Rachna Sehgal, the Associate Commissioning Editor for this
book.
Preface

Unlike electronic systems that transmit and process signals and data, power electronics
involves the processing of substantial amounts of electrical energy. The power range begins
with tens of watts to a few hundred watts in the common AC/DC converter (rectifier) used
in consumer electronic devices such as battery chargers, personal computers or television
sets. In the industry, a common application such as the Variable Speed Drive (VSD), which
is used to control an induction motor, has a power range that starts from a few hundred
watts and can go upto tens of megawatts.
Beginnning with high-vacuum and gas-filled diode thermionic rectifiers, and triggered
devices such as the thyratron and ignitron, the field has evolved to a stage where it can be
said that today power electronics is the application of solid-state electronics to the control
and conversion of electric power. Steady improvements in the voltage and current handling
capacity of solid state devices have made this possible.
During the past few decades the technical aspect of power electronics and drives has
gone through significant scientific progression. Many inventions in strategy, apparatus,
circuit, control and systems have made power electronics a formidable technology during
this period. MATLAB helps learners understand the field because it integrates computation,
visualization, and programming in an easy-to-use environment where problems and
solutions are expressed in familiar mathematical notation. This book introduces this
promising technology with MATLAB/SIMULÏNK in Power Electronic Circuits. It
addresses the progress of early semiconductor devices and then moves on to introduce
recently developed high-performance power semiconductor switching devices and their
applications using MATLAB/SIMULÏNK. It also gives a condensed review of the current
power electronic circuits and their outcomes.
The ultimate purpose of this book is to help engineering students engage in energy
conversion on the up-to-date electronic applications. It covers almost all features and
xxx Preface

facilities of MATLAB/SIMULÏNK and their influence in Power Electronic Circuits like


Rectifiers, Inverters, Converters, Choppers, Cyclo converters etc.
The book is recommended as an introductory handbook for starters and as a text book
for undergraduate and postgraduate engineering students. It can also serve as a reference
book for researchers who need preliminary knowledge of the design and investigation of
Power Electronic Circuits.
1
Introduction to MATLAB

Learning Objectives
 To introduce the fundamental concepts of MATLAB programming

 To learn the basic steps in installation

 To understand the various functions involved in arithmetic and scientific concepts

 To discover the concepts of matrix and vectors, arrays and plotting

 To introduce the steps involved in circuit modelling and simulation

 To examine the basic operation of an electric circuit

 To differentiate the merits and demerits of MATLAB

1.1 Introduction and Outlook


The MATrix LABoratoy (MATLAB) is a high performance interactive multiparadigm
numerical computing software system developed by MathWorks. Cleve Moler started
developing MATLAB in the late 1960s and it was rewritten in C in 1984. MATLAB was
first adopted by researchers and practitioners in control engineering; it has now spread
to all domains. The MATLAB function is built roughly around the MATLAB language
and the main use of MATLAB is the usage of the command window for execution of text
files that includes functions or scripts. MATLAB provides a development environment
for managing various sets of files, codes and multiple datasets. It is used to solve problems
numerically; MATLAB is the best interactive tool for exploring the various levels of
2 Power Electronics with MATLAB

iterations, design, analysis and problem solving. In addition, MATLAB, which is a


contemporary programming language, has its own stylish data structures that also contain
built-in editing and debugging tools, and supports object-oriented programming.
MATLAB can handle plain numerical expressions and mathematical formulas. It
integrates various platforms of computation, visualization, linear algebra, filtering fourier
analysis, statistics and numerical integration in the programming environment. MATLAB
is exclusively intended for matrix computations that involve explaining linear systems,
computing eigenvectors, factoring matrices and arrays. Adding up, it has a variety of
custom graphics capabilities with manipulator boundaries and can be extended over lists
inscribed in its particular program design.
The extended capability of MATLAB enables it to provide solutions for non-linear
problems, such as the elucidation of ordinary differential equations. Thus, it is better
that MATLAB produces fairly accurate solutions rather than exact solutions. As a result,
MATLAB is a tool designed for different tasks and therefore cannot be directly compared
with other mathematical tools. The various functionalities of MATLAB are used to
integrate it with other peripheral applications like FORTAN, C, C++, JAVA.
Nowadays, MATLAB is trending in education and is quite popular among scientists as
it is the best language for encoding. Some applications are packed with reference to the tool
box. The tool boxes include optimization, simulation, signal processing, control systems
and all applied fields of engineering. These are the unique factors that make MATLAB a
tremendous tool for education and investigation.

1.2 How to Start with MATLAB?


Before starting with MATLAB, installation and activation of the tool is very important.
Using the MathWorks installer, installation and activation can be done in some of the
following operating systems:
• Microsoft Windows operating systems (32 or 64 bit)
• Linux operating systems (32 or 64 bit)
• Mac operating systems

The installation and activation process can be accomplished in any of the following two
ways:
• Using an Internet connection
• Without using an Internet connection
Introduction to MATLAB 3

1.2.1 Installing and activation

Before installing, proceed with the steps shown in Tables 1.1 and 1.2.

Table 1.1 Installing and activating using an Table 1.2 Installing and activating without using
Internet connection an Internet connection

Step 1 Commence the installer Step 1 Commence the installer


Step 2 Select ‘Installation using Internet’ Step 2 Select ‘Installation without using
Step 3 Evaluate the agreement of Internet’
software license Step 3 Review the license agreement
Step 4 MathWorks account login
Step 4 Specify the file installation key
Step 5 Choose the license to be
Step 5 Select the type of installation
installed
Step 6 Select the type of installation Step 6 Mention the installation folder

Step 7 Mention the installation folder Step 7 Select the products to be


installed
Step 8 Select the products to be
installed Step 8 Select the installation options

Step 9 Select the installation options Step 9 Confirm the choice of selection

Step 10 Confirm the choice of selection Step 10 Installation is complete


Step 11 Installation is complete Step 11 Activate your installation
Step 12 Activate your installation Step 12 Mention license file path
Step 13 Mention license file path Step 13 Activation complete
Step 14 Activation complete

Once the installation is completed we can start the program using the following steps:
• GOTO start menu
• Double click MATLAB icon
The desktop then appears with the default layout as shown in Figure 1.1, which is the
startup page of MATLAB.
From Figure 1.1, we can see some of the default panels that include: Start button,
command window, current folder, workspace and command history.
Start button We can single click the button for better access of tools and functions.
4 Power Electronics with MATLAB

Command window In the command window, we can enter commands at the command
line, which is indicated by fx>> (This is the command prompt).
Current folder We can access all the MATLAB files from the directory.
Workspace We can explore all the data sets that are imported from the files.
Command history We can view or analyze the commands given in the command
window.
As we start up with MATLAB, the user can type some of the commands, such as helpwin,
helpdesk and demo for better understanding of MATLAB functions and operations.

Figure 1.1 Startup Page of MATLAB.

1.3 MATLAB: A Calculator


When we start up with MATLAB, we come across a notation or a prompt sign that prompts
us to start,
>> _

Since MATLAB is an inferred type language, the variables can be assigned using the
operator ‘=’ without the declaration of their type. Some examples of computation involving
variables and constants are shown here:
Introduction to MATLAB 5

Example 1
>> x = 100
MATLAB responds with
x =
100

Example 2
>> x = “hello”

MATLAB responds with


x = “hello”
Error: The input character is not valid in MATLAB
statements or expressions.

Example 3
>> x = pi
MATLAB responds with
x =
3.1416

1.3.1 Basic arithmetic operations

To perform basic arithmetic operations, MATLAB can be used as an evaluator of expressions.


To execute the mathematical expression, we need to type the numeric constants into the
command window after the prompt and press ENTER. MATLAB will print the result back
in the command window. When an output variable is not assigned, MATLAB utilizes the
default variable ‘ans’ to display the results of the operation.

Example 4 To perform addition


>> 5+2
MATLAB responds with
ans =
7

Example 5 To perform subtraction


>>57−34
6 Power Electronics with MATLAB

MATLAB responds with


ans =
23

Example 6 To perform multiplication


>>67 * 8900000
MATLAB responds with
ans =
596300000

Example 7 To perform division


>>0.0000005/7
MATLAB responds with
ans =
7.1429e−08
Example 8 To perform trigonometric calculations
>>cos(pi/2)
MATLAB responds with
ans =
6.1232e−17

In Figure 1.2, the mathematical computations of arithmetic operations are shown in the
MATLAB window. Thus, it can be clearly seen that the MATLAB tool can be used purely
as a calculator that performs mathematical and scientific operations.

1.3.2 Assigning values to variables

The alternate method of performing arithmetic operations in MATLAB is by assigning a


suitable value to the variables. To create a variable using MATLAB, assign the variables say,
for example, a, b and c with some values.
The basic syntax of assigning variables is as follows

variable name = a value

Here the value can be a function call, operator, variable or a numerical value. Consider the
following examples of assigning values to the variables.
Introduction to MATLAB 7

Figure 1.2 MATLAB as a Calculator.

Example 9
>> a = 2
a = 2

Example 10
>> a = 6
a = 6
>> b = a^2
b = 36

Example 11
>> b = pi/6
b = 0.523626

Example 12
>> c = b + a^0.25
c = 1.7128
In Example 12, it is noted that the variable which is named c exists only as a numerical
value.
8 Power Electronics with MATLAB

Example 13
>>who
Your variables are
a ans b c
The ‘who’ command represents the list of active variables that are currently available.

Example 14
>> clc
The ‘clc’ command clears the screen. It refreshes or empties the command window for a
new set of operations.
Figure 1.3 shows how to assign values to variables in the MATLAB window.

Figure 1.3 Working with Variables.

Some of the other tasks available in MATLAB computing are overwriting of variables,
controlling the hierarchy, controlling the precision of floating points, multiple statements
and display of error message.

Example 15
Overwriting of variables
>> a = 7;
Introduction to MATLAB 9

>> a = a + 4
a =
11
The purpose of the semicolon (;) is to suppress the result after execution.

Example 16
Controlling the hierarchy
>>a = (1 + 2) * 3
a =
9
>> a = 1 + 2 * 3
a =
7
Here similar expressions produce different results. To avoid erroneous results, MATLAB
considers hierarchy of mathematical operations to perform calculations.

Example 17
Controlling the precision of the floating number
The length of the floating number of the assigned variable can be increased or decreased
using the syntax
“format short”
“format long”

>> 1/5987666555
ans =
1.670099680425508e−10
>> format short
>> x = 1/56565656565
x =
1.7679e−11
>> format long
>> x = 1/56565656565
x =
1.767857142877663e−11
10 Power Electronics with MATLAB

Example 18
Multiple statements
>> a = 4;
>> b = cos(a) * sin(a)
b =
0.494679123311691
The execution of multiple statements includes the execution of all linear expressions
separated by commas (,) or semicolons (;).

Example 19
Display of error messages
>> x = 12; y = 32;
z = x + w
Undefined function or variable ‘w’.

When an undefined variable is being executed, the MATLAB responds with an error stating
‘undefined function or variable’.
To terminate the session, we use the command called ‘quit’ in the command window to
exit the application.

1.4 Basic Features of MATLAB


1.4.1 Investigation of a MATLAB function

In technical computing, having a large set of predefined mathematical functions is very


important. Since MATLAB is an interactive tool for computation, it stores a large set of
mathematical functions in the inbuilt mode. These stored functions are called built-in
functions. Most mathematics standards are executed using the built-in functions. A set
of mathematical functions collectively forms a MATLAB program. Hence, the MATLAB
programs are stored in the form of plain text as files with an extension ‘.m’. Such files are
called m-files. The unique quality of MATLAB is that the files can be used interactively,
which also favours the process of debugging the files for huge programs.

1.4.2 Mathematical functions

Like BASIC language, the large set of various arithmetic operations can be assigned to the
variables that are defined. The basic syntax of mathematical functions are listed here:
Introduction to MATLAB 11

Exponential and Logarithmic Functions


exp (x) Exponential; ex
log (x) Natural logarithm; ln(x)
log10 (x) Common (base 10) logarithm; log(x) = log10(x)
sqrt (x) Square root; √x

Trigonometric Functions
acos (x) Inverse cosine; arcos x = cos − 1 (x)
asin (x) Inverse sine; arcsin x = sin − 1 (x)
atan (x) Inverse tangent; arctan x = tan − 1 (x)
cos (x) Cosine; cos(x)
sin (x) Sine; sin(x)
tan (x) Tangent; tan(x)

Some of the other types of trigonometric functions include acot (x), acsc (x), asec (x),
atan2(y, x), cot (x), csc (x), and sec (x).

Hyperbolic Functions
acosh (x) Inverse hyperbolic cosine; cosh − 1 (x)
acoth (x) Inverse hyperbolic cotangent; coth − 1 (x)
cosh (x) Hyperbolic cosine; cosh(x)
coth (x) Hyperbolic cotangent; cosh(x)/sinh(x)
sech (x) Hyperbolic secant; 1/cosh(x)
sinh (x) Hyperbolic sine; sinh(x)
Other types of hyperbolic functions include acoth (x), acsch (x), asech (x), atanh (x), asinh
(x), csch (x) and tanh (x).

Complex Functions
abs (x) Absolute value; |x|
angle (x) Complex number angle x
conj (x) Complex conjugate of x
imag (x) Imaginary part of a complex number x
real (x) Real part of a complex number x
12 Power Electronics with MATLAB

Statistical Functions

erf (x) Compute error function erf (x)


mean Compute mean or average
median Compute median
std Compute standard deviation

Random Number Functions


rand Generates uniformly distributed random numbers between 0 and 1
randn Generates normally distributed random numbers

Numeric Functions
ceil Rounds to the nearest integer towards •
fix Rounds values to the nearest integer towards zero
floor Rounds to the nearest integer towards •
round Rounds to the nearest integer
sign Signup function

String Functions
findstr Occurrence of a string
strcmp String comparison
char String array character

Following is a typical example that relates to the basic mathematical functions.

Example 20
Solve for the expression g = sin(x) + sin(y)(log x) + e1 with values of x = 3, y = 7 and z = 6.
>> x = 3; y = 7; z = 6;
>> g = sin(x) + sin(y) * log(x) + exp(1)
g =
3.581175387361639

1.4.3 Vector and matrix operations

1.4.3.1 Vector Operations

MATLAB is an easy to understand tool that helps in controlling matrices and vector
ideas. The essential functions of MATLAB rotate around the use of vectors and a vector is
Introduction to MATLAB 13

characterized by putting a succession of numbers inside the matrices, though in reality, a


system could be characterized as the fundamental data set component in MATLAB.
A column vector can be characterized with an exhibit of 1 × n measurements. The
estimations of a vector can be encased inside a square section and may be divided by
commas or by spaces. Consider the following example of how to assign a name to a row
vector.

Example 21
A>> v = [1 2 3 4 5 6 7 8 9] click ENTER
v =
1 2 3 4 5 6 7 8 9
A column vector can also be characterized with an exhibit of m × 1 measurements. Like the
line vector, the estimates can be encased inside a square section divided by spaces or with
commas. Column vectors can even be made by utilizing semicolons (;) inside the square
sections to divide the values. To make a section vector, simply take the transpose of the row
vector utilizing the image ('). Following are illustrations for a segment vector.

Example 22
>> v = [−34 56 −445 54 −2 −5]’ click ENTER
v =
−34
56
−445
54
−2
−5

Example 23
>> v = [1;7;9;67;9]
v =
1
7
9
67
9
14 Power Electronics with MATLAB

A vector can be of any length. Following is an exchange method for characterizing a vector
for a set of qualities.

Example 24
>> v = [1:9]
v =
1 2 3 4 5 6 7 8 9
Another method of manipulating vectors is by the addition of the vector with a scaling.
In this method, to get a component of a vector, we utilize the image colon (:). Assume,
for example that we need to characterize a vector with a beginning quality and the closure
esteem along with the addition esteem. The vector could be written as follows.

Example 25
>> v = [1:.20:7]
v =
Columns 1 through 3
1.000000000000000 1.200000000000000 1.400000000000000
Columns 4 through 6
1.600000000000000 1.800000000000000 2.000000000000000
Columns 7 through 9
2.200000000000000 2.400000000000000 2.600000000000000
Columns 10 through 12
2.800000000000000 3.000000000000000 3.200000000000000
Columns 13 through 15
3.400000000000000 3.600000000000000 3.800000000000000
Columns 16 through 18
4.000000000000000 4.199999999999999 4.400000000000000
Columns 19 through 21
4.600000000000000 4.800000000000000 5.000000000000000
Columns 22 through 24
5.200000000000000 5.400000000000000 5.600000000000000
Columns 25 through 27
5.800000000000000 6.000000000000000 6.200000000000000
Introduction to MATLAB 15

Columns 28 through 30
6.400000000000000 6.600000000000000 6.800000000000000
Column 31
7.000000000000000
From this illustration, it can be seen that a line of vectors beginning from 1 to 7 with
increment in the estimations of .20 is continuously registered. MATLAB executes the
entries that are needed faultlessly. Subsequently, a set of 31 sections are continuously
declared to characterize the given vector.
The following program accesses elements within the vector, just type

Example 26
>> v(4)
ans =
1.600000000000000
The result brings out the estimation of the vector created in Example 25, that is, the fourth
entrance of the vector has been printed. The other values are excluded. Therefore, the result
is continuously printed with the ans.
The following is a program that signifies the end value of the vector

Example 27
>> v(1, end)
ans =
7
The following program tracks the recent or the past result of a vector.

Example 28
>> ans’
ans =
1.600000000000000
A simple example for operating with vector is shown here.

Column vector:

Example 29
>> v = [1:5:8]; u = [3:6:4];
>> y = 2 * (u + v)
16 Power Electronics with MATLAB

y =
8 18

Row vector:

Example 30
>> v = [1:5:8]’; u = [3:6:4]’;
>> y = 5 * (u + v)
y =
20
45

The vector can also be represented in a simpler form.

Example 31
>> v(:) for column vector
>> v(1:end) for row vector

MATLAB, as a matter of course, stores all the outputs that have been executed, which is
convenient when substantial set of operations or reckonings are continuously done.

1.4.3.2 Matrix operation

To perform matrix operation, a system in MATLAB could be characterized as a show of


numbers. A network is like a vector with a gathering of column and segment vectors.
The following examples represent a 3 × 3 matrix as rows of column vectors or columns

Example 32
>> x = [1 4 6; 2 4 5; 5 6 7]
x =
1 4 6
2 4 5
5 6 7
The transpose of this vector can be obtained by using the symbol (‘);
Introduction to MATLAB 17

Example 33
>> x = [1 4 6; 2 4 5; 5 6 7]’
x =
1 2 5
4 4 6
6 5 7
Henceforth, to manage matrix operations in MATLAB, the notations to be considered are
square section, commas and semicolon as said previously for vector operations.
To extract a particular element in a matrix, we can perform the following operation.

Example 34
>> x(1,3)
ans =
5
The element, being located in row 1 and column 3 of x in Example 33, is executed.

1.4.3.2.1 Indexing of a matrix


Indexing of a network can be done in different ways as for the vector. The components
could be named with i and j in it for a column and a section for matrix x. A component can
be denoted as x (i, j) or xij. The record of a network is parted into two. The main file could
be the line number and the second one could be the segment number.

Consider a matrix
x =
1 2 5
4 4 6
6 5 7
The following example shows us how to replace, say, the second column and second row
value 4, by any other value, say 6.

Example 35
>>x(2,2) = 6
x =
18 Power Electronics with MATLAB

1 2 5
4 6 6
6 5 7
Zero and negative qualities are not acknowledged though the components can be obtained
as x(i, j) where i ≥ 1 and j

1.4.3.2.2 Inverse of a matrix

Example 36

Consider the matrix


x =
1 2 5
4 6 6
6 5 7
The following example shows how we can operate with a matrix in terms of its inverse.

Example 37
>> inv(x)
ans =
−0.230769230769231 −0.211538461538462 0.346153846153846
−0.153846153846154 0.442307692307692 −0.269230769230769
0.307692307692308 −0.134615384615385 0.038461538461538
To calculate the eigenvalues of the matrix x, we can perform the following operation.

Example 38
x =
1 2 5
4 6 6
6 5 7
>> eig(x)
ans =
14.645217647029696
−2.234341959325249
1.589124312295557
Introduction to MATLAB 19

Let us see how we can manipulate the eigenvector and the eigenvalues.

Example 39
>> [v,e] = eig(x)
v =
−0.345702432092625 −0.842635176101989 0.362970606773015
−0.637690615601249 0.017156405528112 −0.849621987304843
−0.688360739161774 0.538211499082772 0.382615756741668
e =
14.645217647029696 0 0
0 −2.234341959325249 0
0 0 1.589124312295557
To obtain the diagonal values, we can perform the following operation.

Example 40
>> diag(x)
ans =
1
6
7
The other subroutines under matrix operations are the approximation values of linear
expressions.
For example, to obtain the solution for Ax = B, we can perform the following operation.

Example 41
>> v=[1 2 3]; x=[1.428 7.926 4.856];
>> A = x/v
A =
1.428571428571429
2.428571428571428
2.642857142857143
>> B = [ 1 2 4];
>> A = B/v
>> A = B/v
20 Power Electronics with MATLAB

A =
1.214285714285714
>> A * B
ans =
1.214285714285714 2.428571428571428 4.857142857142857
>> A1 = v/B
A1 =
0.809523809523809
>> A1 * B
ans =
0.809523809523809 1.619047619047619 3.238095238095238

1.4.3.2.3 Concatenating of matrices


Concatenation includes the creation of submatrices.

Example 42
x =
1 2 5
4 6 6
6 5 7
The submatrix would be
>> y = [x 10 * x; -x [1 0 0; 0 1 0; 0 0 1]]
y =
1 2 5 10 20 50
4 6 6 40 60 60
6 5 7 60 50 70
−1 −2 −5 1 0 0
−4 −6 −6 0 1 0
−6 −5 −7 0 0 1

1.4.3.2.4 To delete a row or a column


Use the empty vector to delete any row or a column.
Introduction to MATLAB 21

Example 43
>> x(2,:) = []
x =
1 2 5
6 5 7
Other matrix generators include functions, such as eye, zeros and ones. The intellectual
properties of matrices include hilb, invhilb, magic, pascal, toeplitz, vander and Wilkinson.
There is also the whos command which will identify the set of variables in the workspace.

Example 44
>> whos
Name Size Bytes Class Attributes
A 1×1 8 double
A1 1×1 8 double
B 1×3 24 double
a 1×1 8 double
ans 1×3 24 double
b 1×1 8 double
c 1×1 8 double
e 3×3 72 double
g 1×1 8 double
u 1×1 8 double
v 1×3 24 double
x 2×3 48 double
y 6×6 288 double
z 1×1 8 double

1.4.4 Arrays

In MATLAB, the vector can be considered to be an array of single dimension and the
matrix an array of two dimensions. The variables are multidimensional.
The basic type of an array includes two types:
22 Power Electronics with MATLAB

A double argument creates a rectangular array.

Example 45
>> ones(8)
ans =
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
A single argument creates a square array.

Example 46
>> zeros(1,8)
ans =
0 0 0 0 0 0 0 0
The function ‘eye’ represents the identity matrix.

Example 47
>> eye(4)
ans =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
The function ‘random’ creates a Example 48 distributed random numbers.

Example 48
>> rand (3,8)
ans =
Introduction to MATLAB 23

Columns 1 through 3
0.814723686393179 0.913375856139019 0.278498218867048
0.905791937075619 0.632359246225410 0.546881519204984
0.126986816293506 0.097540404999410 0.957506835434298
Columns 4 through 6
0.964888535199277 0.957166948242946 0.141886338627215
0.157613081677548 0.485375648722841 0.421761282626275
0.970592781760616 0.800280468888800 0.915735525189067
Columns 7 through 8
0.792207329559554 0.035711678574190
0.959492426392903 0.849129305868777
0.655740699156587 0.933993247757551
These are the set of special arrays that are especially used by MATLAB functionalities.

1.4.4.1 Multidimensional arrays


Multidimensional clusters in MATLAB have more than two measurements. They are
expansions of the typical two-dimensional matrix. A two-dimensional cluster can be
converted into a multidimensional matrix.

Example 49
>> x = [2 4 5; 3 5 6; 5 6 7]
x =
2 4 5
3 5 6
5 6 7
To improve the dimension of the array, we do the following operation.
>> x(:, :, 2) = [ 1 2 3; 4 5 6; 7 8 9]
x(:, :, 1) =
2 4 5
3 5 6
5 6 7

You might also like