**Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals**

Ian Grout and Abu Khari Bin A'ain

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/46461

## **1. Introduction**

358 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

4244-7763-0

Varga, M. & Varga, Z. (2010) Utilizing Matlab in secondary technical education, In: *Proceedings of the 33rd International Convention, MIPRO*, 2010, pp. 970-974, ISBN: 978-1-

> Mathematical analysis tools provide an invaluable (and sometime essential!) tool for use within the engineering disciplines and are readily found in education, research and industrial applications. For example, within the industrial applications, mathematical analysis tools provide an essential aid at all stages of a product development from design through manufacture to test. Although there are a number of useful tools available, since its inception, MATLAB [1] has found a unique role within the engineering disciplines. Given the need to utilise this tool ultimately in both a research context and an industrial application context, there is a need to introduce students at the university level to the effective use of MATLAB, with a focus on the particular discipline area of the student.

> In this chapter, the use of MATLAB is presented and discussed within a university education context and in particular the integration of MATLAB into the teaching and learning of semiconductor device fundamentals for electronic and computer engineering students. The aim is to support the student learning of semiconductor device operation, primarily diodes (silicon, germanium, Schottky barrier and Zener) and transistors (bipolar junction transistors (BJTs), junction field effect transistors (JFETs) and metal-oxide semiconductor field effect transistors (MOSFETs)).

> MATLAB is primarily used as a data analysis, presentation and reporting tool in this context, but the natural integration of MATLAB into the teaching and learning environment has two real purposes:


The basic idea is that experiments are undertaken on practical devices, the results obtained are then analysed in MATLAB and finally compared to the ideal device (mathematical)

models. Hence, within MATLAB, actual data is used and mathematical models of ideal devices are developed. This is aimed as an introduction (targeting first year undergraduate students) to both semiconductor devices and to mathematical analysis tools (here MATLAB which would then be used by the students later on in more advanced subjects).

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 361

as well as the key commands to be used before attempting to analyse experiment data. One

possible laboratory experiment flow is shown in figure 4.

**Figure 1.** The traditional learning scenario

**Figure 2.** The computer aided learning scenario

**Figure 3.** Remote user access via an Internet browser learning scenario

Three different teaching and learning scenarios are presented and the integration of MATLAB into a computer aided learning (CAL) environment that has been custom developed are provided:

Firstly, students undertake experiments in a *traditional learning scenario.* In the laboratory, electronic circuits using semiconductor devices are built and tested. Experimental results are then taken and analysed using MATLAB; specifically, results are entered into arrays (the term *array* used here to mean a *1 x m* matrix) within MATLAB which then allows these results to be analysed and graphically plotted. These results are also compared to the ideal mathematical equations for the devices considered (specifically diodes and transistors). Hence, the learning experience naturally includes an introduction to concepts such as scalar types and arrays (in a generic context, matrices and matrix manipulation), building and manipulating equations, manipulating experiment results, results comparison, graphical plotting and m-files. The student therefore gains experience in both electronic hardware build and test, and results analysis using MATLAB. This is suitable for electronic and computer engineering students at an introductory level. This idea is depicted in figure 1.

Secondly, students undertake experiments using *computer aided learning (CAL) environment*. The experiment electronic hardware is pre-built and connected to a PC via an *experiment interface electronics* unit (essentially a computer port connection such as RS-232 (readily extended to USB) interface that allows for analogue voltages to be created and sampled in the same manner as would manually be done, but now through a software graphical user interface (GUI)). The student therefore gains experience in computer control of experiments and results analysis using MATLAB. This is suitable for electronic and computer engineering students at an introductory level who would not necessarily need to physically build electronic hardware. This idea is depicted in figure 2.

Thirdly, students undertake experiments via a *distance mode of learning* in that they access the experiment electronic hardware and MATLAB via an Internet browser. This arrangement forms a *remote laboratory* whereby the experiment is controlled and results accessed remotely and via an Internet browser. Essentially, the CAL arrangement identified in figure 2 is "web enabled" – that is made accessible via the Internet. The student gains therefore experience in computer control and results analysis using MATLAB, but in a distance mode of learning. This idea is depicted in figure 3.

The above three teaching and learning scenarios provide ways in which MATLAB can be integrated into a flexible teaching and learning environment. However, given that the idea here is that both the use of MATLAB and the electrical characteristics of basic semiconductor devices are to be introduced, the structure of the laboratory experiments must be carefully considered. For example, it would be necessary to introduce the basic concepts of MATLAB as well as the key commands to be used before attempting to analyse experiment data. One possible laboratory experiment flow is shown in figure 4.

**Figure 1.** The traditional learning scenario

360 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

which would then be used by the students later on in more advanced subjects).

developed are provided:

models. Hence, within MATLAB, actual data is used and mathematical models of ideal devices are developed. This is aimed as an introduction (targeting first year undergraduate students) to both semiconductor devices and to mathematical analysis tools (here MATLAB

Three different teaching and learning scenarios are presented and the integration of MATLAB into a computer aided learning (CAL) environment that has been custom

engineering students at an introductory level. This idea is depicted in figure 1.

need to physically build electronic hardware. This idea is depicted in figure 2.

MATLAB, but in a distance mode of learning. This idea is depicted in figure 3.

The above three teaching and learning scenarios provide ways in which MATLAB can be integrated into a flexible teaching and learning environment. However, given that the idea here is that both the use of MATLAB and the electrical characteristics of basic semiconductor devices are to be introduced, the structure of the laboratory experiments must be carefully considered. For example, it would be necessary to introduce the basic concepts of MATLAB

Secondly, students undertake experiments using *computer aided learning (CAL) environment*. The experiment electronic hardware is pre-built and connected to a PC via an *experiment interface electronics* unit (essentially a computer port connection such as RS-232 (readily extended to USB) interface that allows for analogue voltages to be created and sampled in the same manner as would manually be done, but now through a software graphical user interface (GUI)). The student therefore gains experience in computer control of experiments and results analysis using MATLAB. This is suitable for electronic and computer engineering students at an introductory level who would not necessarily

Thirdly, students undertake experiments via a *distance mode of learning* in that they access the experiment electronic hardware and MATLAB via an Internet browser. This arrangement forms a *remote laboratory* whereby the experiment is controlled and results accessed remotely and via an Internet browser. Essentially, the CAL arrangement identified in figure 2 is "web enabled" – that is made accessible via the Internet. The student gains therefore experience in computer control and results analysis using

Firstly, students undertake experiments in a *traditional learning scenario.* In the laboratory, electronic circuits using semiconductor devices are built and tested. Experimental results are then taken and analysed using MATLAB; specifically, results are entered into arrays (the term *array* used here to mean a *1 x m* matrix) within MATLAB which then allows these results to be analysed and graphically plotted. These results are also compared to the ideal mathematical equations for the devices considered (specifically diodes and transistors). Hence, the learning experience naturally includes an introduction to concepts such as scalar types and arrays (in a generic context, matrices and matrix manipulation), building and manipulating equations, manipulating experiment results, results comparison, graphical plotting and m-files. The student therefore gains experience in both electronic hardware build and test, and results analysis using MATLAB. This is suitable for electronic and computer

**Figure 2.** The computer aided learning scenario

**Figure 3.** Remote user access via an Internet browser learning scenario

362 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 363

The use of MATLAB is presented whereby physical circuits with the semiconductor devices of interest are developed and tested by the student. Results are then entered into MATLAB and analysis undertaken, comparing the real devices with their mathematical ideal models. Current and voltage relationships are then identified. The student gains hands-on experience with both electronic hardware and computer based

The use of MATLAB is presented as in case study 1, but now pre-built experiments are accessed through a custom software application and the experiments are accessed via a PC interfaced electronic hardware arrangement. The student concentrates on the

The use of MATLAB is presented as in case study 2, but now the interface is via a remote laboratory arrangement, accessed via an Internet browser and web server

MATLAB is an invaluable tool for use within the engineering disciplines for education, research and industrial purposes. In this chapter, the use of MATLAB is presented and discussed within a university education context. MATLAB is an almost universal tool for engineering education. It provides a cost-effective *what if* platform where users can manipulate and explore functions to discover and explore the response of a system. Here, the system is an electronic circuit where the focus of the circuit operation is discovering and

MATLAB is a high-level language and interactive environment that enables a user to perform computationally intensive engineering and scientific calculations tasks faster than with traditional programming languages such as C. It includes a set of integrated graphics and plotting capabilities allowing users to visualise their data and analysis results and which can also be extended by the user to suit his or her own needs. As such, it provides the student and practising engineer with a suite of useful tools for analysing and solving engineering related problems. For semiconductor devices made from semiconductor

Section 4: Case study 1: at presence learning (stand alone experiments)

Section 5: Case study 2: at presence learning (computer aided learning (CAL))

Section 6: Case study 3: remote laboratory access (for distance based learners)

arrangement. With this arrangement, remote learners are supported.

Conclusions to the work that has been undertaken are presented.

References used in the development of the chapter are provided.

**2. The use of MATLAB within an education environment** 

exploring the behaviour of semiconductor devices.

MATLAB and software side of the experiment activity.

software.

Section 7: Conclusions

Section 8: References

**2.1. Introduction** 

**2.2. Why use MATLAB?** 

**Figure 4.** Laboratory experiment "flow"

The development of the hardware-software infrastructure and use of the three above teaching and learning scenarios are introduced here with reference to an experiment consisting of a BAT86 Schottky barrier diode [2] and are presented in this chapter. The remainder of the chapter is structured as follows:

Section 2: The use of MATLAB within an education environment

The use of MATLAB as an aid to teaching and learning for a wide range of engineering and scientific applications is presented. A rationale for using MATLAB is provided and how it may be used is identified. Reference is made to the teaching and learning in the computer and electronic engineering disciplines.

Section 3: Teaching and learning semiconductor device fundamentals

The teaching of semiconductor device fundamentals at an introductory level within the university sector is presented with reference to current teaching undertaken by the authors. The need for teaching semiconductor devices and their application in the electronics and microelectronic industries is provided, along with the need to relate the theory to real (practical) devices through the use of suitable laboratory experiments undertaken by the students. The use of MATLAB as an integrated mathematical analysis tool is presented where theory and practice are compared.

Section 4: Case study 1: at presence learning (stand alone experiments)

The use of MATLAB is presented whereby physical circuits with the semiconductor devices of interest are developed and tested by the student. Results are then entered into MATLAB and analysis undertaken, comparing the real devices with their mathematical ideal models. Current and voltage relationships are then identified. The student gains hands-on experience with both electronic hardware and computer based software.

Section 5: Case study 2: at presence learning (computer aided learning (CAL))

The use of MATLAB is presented as in case study 1, but now pre-built experiments are accessed through a custom software application and the experiments are accessed via a PC interfaced electronic hardware arrangement. The student concentrates on the MATLAB and software side of the experiment activity.

Section 6: Case study 3: remote laboratory access (for distance based learners)

The use of MATLAB is presented as in case study 2, but now the interface is via a remote laboratory arrangement, accessed via an Internet browser and web server arrangement. With this arrangement, remote learners are supported.

Section 7: Conclusions

362 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

The development of the hardware-software infrastructure and use of the three above teaching and learning scenarios are introduced here with reference to an experiment consisting of a BAT86 Schottky barrier diode [2] and are presented in this chapter. The

The use of MATLAB as an aid to teaching and learning for a wide range of engineering and scientific applications is presented. A rationale for using MATLAB is provided and how it may be used is identified. Reference is made to the teaching and learning in the

The teaching of semiconductor device fundamentals at an introductory level within the university sector is presented with reference to current teaching undertaken by the authors. The need for teaching semiconductor devices and their application in the electronics and microelectronic industries is provided, along with the need to relate the theory to real (practical) devices through the use of suitable laboratory experiments undertaken by the students. The use of MATLAB as an integrated mathematical

**Figure 4.** Laboratory experiment "flow"

remainder of the chapter is structured as follows:

Section 2: The use of MATLAB within an education environment

Section 3: Teaching and learning semiconductor device fundamentals

analysis tool is presented where theory and practice are compared.

computer and electronic engineering disciplines.

Conclusions to the work that has been undertaken are presented.

Section 8: References

References used in the development of the chapter are provided.

### **2. The use of MATLAB within an education environment**

#### **2.1. Introduction**

MATLAB is an invaluable tool for use within the engineering disciplines for education, research and industrial purposes. In this chapter, the use of MATLAB is presented and discussed within a university education context. MATLAB is an almost universal tool for engineering education. It provides a cost-effective *what if* platform where users can manipulate and explore functions to discover and explore the response of a system. Here, the system is an electronic circuit where the focus of the circuit operation is discovering and exploring the behaviour of semiconductor devices.

#### **2.2. Why use MATLAB?**

MATLAB is a high-level language and interactive environment that enables a user to perform computationally intensive engineering and scientific calculations tasks faster than with traditional programming languages such as C. It includes a set of integrated graphics and plotting capabilities allowing users to visualise their data and analysis results and which can also be extended by the user to suit his or her own needs. As such, it provides the student and practising engineer with a suite of useful tools for analysing and solving engineering related problems. For semiconductor devices made from semiconductor materials such as silicon, which the work discussed in this chapter are aim at exploring, MATLAB is the perfect tool to use as it allows the student to undertake directed and self study activities, even outside laboratory. As the calls for innovation and creativity become stronger, students cannot afford to limit their experiments and exploration within physical laboratory. By integrating MATLAB within experiments and the course syllabus, it supports self-directed learning and also does not cost anything to make mistakes!

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 365

the tool before using it to solve problems relating to a specific electronic and computer

The MATLAB desktop provides the method in which a user interfaces to MATLAB and hence a working knowledge of the desktop must be obtained. However, learning the structure of the desktop should not become the focus of the learning and so detract

When learning how to use any software application and a new language, errors in the use of the software application, along with syntax and semantic errors with the language will inevitably be experienced by the student. How to deal with these errors can be a daunting task for a student and so the prompt correcting of these errors would be important. It would be expected that there would be a common set of errors encountered by many

Within MATLAB, everything is treated as a matrix. Hence, the students would need to revise their previous learning of matrices and apply the concepts within the MATLAB environment, learning how to create and manipulate matrices using the native syntax. For example, a common problem encountered when learning how to use MATLAB is in the multiplication of matrices (for example, such as determining the square of an *n x m* matrix named *y* if attempting to use the command *y^2* directly and *y* is not a square matrix).

The starting point of learning the tool is how to effectively use the MATLAB command line for data and command entry. Once the basic concepts are learnt, the use of m-files (both script m-files and function m-files [3]) can then be introduced and from there onwards, m-files may become a more convenient manner in which to enter

The use of arithmetic operators (addition, subtraction, multiplication, division, left division, power) when considering scalar values (*1 x 1* matrices) and matrices (*n x m* matrices). How the arithmetic operations are undertaken – operations undertaken on the complete matrix or matrix element-by-element in turn. This requires a working

The use of logical operators (less than, less than or equal to, greater than, greater than or equal to, equal to, not equal to, logical AND, logical OR) for determining conditions of

A number of mathematical functions are available to create equations (including absolute value, square root, sine (value in radians), cosine (value in radians), tangent

engineering discipline, namely semiconductor devices.

from learning how to use the tool to solve real engineering problems.

students and so many errors should be readily identifiable and corrected.

4. Navigating the MATLAB desktop

5. Dealing with errors

6. Matrix manipulation

7. Command line entry Vs m-files

data and commands.

knowledge of matrix algebra.

the variables within the MATLAB workspace.

8. Arithmetic operators

9. Logical operators

10. Functions

## **2.3. Important concepts to introduce**

With the integration of MATLAB into a course syllabus, there is a need to identify the key concepts to introduce and for the students to practice. It is therefore important for the course developer to ensure that there is a seamless integration of MATLAB into the course syllabus and for there to be a clear focus on why and how this mathematical analysis tool is used. Therefore the course developer needs to consider a wide range of aspects including:

1. The role of MATLAB

Why is MATLAB utilised in the course with a focus on the engineering discipline concerned? How would there be a suitable and seamless integration of the analysis tool with the core engineering topics in the course? How much time should be allocated to the teaching and learning of MATLAB core concepts Vs the use of MATLAB to solve engineering problems?

2. What is important for electronic and computer engineering students

Why utilise mathematical analysis tools in electronic and computer engineering and how can they be used to support the practicing engineer? With MATLAB being introduced to the students for the first time, how can this support more advanced engineering topics? For example, MATLAB with its toolbox Simulink is widely used in control engineering and where students are introduced to control engineering concepts, their knowledge of MATLAB from this introductory course could be used to allow the teaching of the control engineering to concentrate on using MATLAB rather than reintroducing the core MATLAB concepts.

3. Consider a stand-alone module (i.e., just MATLAB) or integrate MATLAB into subject (as considered here)

The introduction to students of MATLAB can be either the main focus of a course whereby the introduction to MATLAB is the purpose of the course, or MATLAB can be introduced as a tool to use in supporting engineering disciplines. Whilst allocating a complete course to MATLAB would allow students to consider both the introductory concepts and the more advanced concepts (such as the use of the toolboxes), it might not necessarily provide a link to the use of this tool in solving engineering discipline specific problems. It also means that valuable and restricted time within the overall programme of study (the available time needs to be allocated to many different aspects of engineering) which should be focused on the specific engineering discipline is not necessarily allocated to the focus area of the overall programme of study. The alternative approach, as considered here, is to provide a more generic introduction to the tool before using it to solve problems relating to a specific electronic and computer engineering discipline, namely semiconductor devices.

4. Navigating the MATLAB desktop

The MATLAB desktop provides the method in which a user interfaces to MATLAB and hence a working knowledge of the desktop must be obtained. However, learning the structure of the desktop should not become the focus of the learning and so detract from learning how to use the tool to solve real engineering problems.

5. Dealing with errors

364 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

self-directed learning and also does not cost anything to make mistakes!

2. What is important for electronic and computer engineering students

reintroducing the core MATLAB concepts.

**2.3. Important concepts to introduce** 

1. The role of MATLAB

engineering problems?

(as considered here)

materials such as silicon, which the work discussed in this chapter are aim at exploring, MATLAB is the perfect tool to use as it allows the student to undertake directed and self study activities, even outside laboratory. As the calls for innovation and creativity become stronger, students cannot afford to limit their experiments and exploration within physical laboratory. By integrating MATLAB within experiments and the course syllabus, it supports

With the integration of MATLAB into a course syllabus, there is a need to identify the key concepts to introduce and for the students to practice. It is therefore important for the course developer to ensure that there is a seamless integration of MATLAB into the course syllabus and for there to be a clear focus on why and how this mathematical analysis tool is used.

Why is MATLAB utilised in the course with a focus on the engineering discipline concerned? How would there be a suitable and seamless integration of the analysis tool with the core engineering topics in the course? How much time should be allocated to the teaching and learning of MATLAB core concepts Vs the use of MATLAB to solve

Why utilise mathematical analysis tools in electronic and computer engineering and how can they be used to support the practicing engineer? With MATLAB being introduced to the students for the first time, how can this support more advanced engineering topics? For example, MATLAB with its toolbox Simulink is widely used in control engineering and where students are introduced to control engineering concepts, their knowledge of MATLAB from this introductory course could be used to allow the teaching of the control engineering to concentrate on using MATLAB rather than

3. Consider a stand-alone module (i.e., just MATLAB) or integrate MATLAB into subject

The introduction to students of MATLAB can be either the main focus of a course whereby the introduction to MATLAB is the purpose of the course, or MATLAB can be introduced as a tool to use in supporting engineering disciplines. Whilst allocating a complete course to MATLAB would allow students to consider both the introductory concepts and the more advanced concepts (such as the use of the toolboxes), it might not necessarily provide a link to the use of this tool in solving engineering discipline specific problems. It also means that valuable and restricted time within the overall programme of study (the available time needs to be allocated to many different aspects of engineering) which should be focused on the specific engineering discipline is not necessarily allocated to the focus area of the overall programme of study. The alternative approach, as considered here, is to provide a more generic introduction to

Therefore the course developer needs to consider a wide range of aspects including:

When learning how to use any software application and a new language, errors in the use of the software application, along with syntax and semantic errors with the language will inevitably be experienced by the student. How to deal with these errors can be a daunting task for a student and so the prompt correcting of these errors would be important. It would be expected that there would be a common set of errors encountered by many students and so many errors should be readily identifiable and corrected.

6. Matrix manipulation

Within MATLAB, everything is treated as a matrix. Hence, the students would need to revise their previous learning of matrices and apply the concepts within the MATLAB environment, learning how to create and manipulate matrices using the native syntax. For example, a common problem encountered when learning how to use MATLAB is in the multiplication of matrices (for example, such as determining the square of an *n x m* matrix named *y* if attempting to use the command *y^2* directly and *y* is not a square matrix).

7. Command line entry Vs m-files

The starting point of learning the tool is how to effectively use the MATLAB command line for data and command entry. Once the basic concepts are learnt, the use of m-files (both script m-files and function m-files [3]) can then be introduced and from there onwards, m-files may become a more convenient manner in which to enter data and commands.

8. Arithmetic operators

The use of arithmetic operators (addition, subtraction, multiplication, division, left division, power) when considering scalar values (*1 x 1* matrices) and matrices (*n x m* matrices). How the arithmetic operations are undertaken – operations undertaken on the complete matrix or matrix element-by-element in turn. This requires a working knowledge of matrix algebra.

9. Logical operators

The use of logical operators (less than, less than or equal to, greater than, greater than or equal to, equal to, not equal to, logical AND, logical OR) for determining conditions of the variables within the MATLAB workspace.

#### 10. Functions

A number of mathematical functions are available to create equations (including absolute value, square root, sine (value in radians), cosine (value in radians), tangent (value in radians), the exponential operator, the logarithmic operator, the value of pi (), the imaginary unit (i or j = (-1))).

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 367

**3. Teaching and learning of semiconductor device fundamentals** 

semiconductor device fundamentals:

useful electronic circuits.

These are summarised in figure 5.

reverse bias conditions).

integrated circuits (ICs).

idealised and more realistic device models).

semiconductor contact can be introduced and developed:

interest in the Schottkty barrier diode discussions.

For electronic and computer engineers, the use of semiconductor devices is integral to everything that they do, whether they design electronic circuits using semiconductor devices or program processors to control specific electronic circuits. Whilst practising engineers may not necessarily investigate the physics of the devices on a day-to-day basis, it is essential that they understand the behaviour of the devices at the material level (how they behave and why) in order to use these devices effectively within the electronic circuits they design or use. There are therefore two key aspects to the teaching and learning of

1. The **theory underpinning the device operation** – what is happening at the physical material level and how the behaviour can be related to device terminal behaviour in terms of voltages and currents (the development of theoretical mathematical models for

2. How the **device terminal behaviour in terms of voltages and currents** (using the developed idealised and more realistic device models) can be used in practical and

For example, consider an introduction to diodes. Both semiconductor (p-n junction) and Schottky barrier (metal-semiconductor contact) diodes are encountered and so must be introduced. The concepts identified in theses devices (such as a.c. signal rectification) would then be extended to more complex devices such as transistors, thyristors, triacs and

Consider the Schottky barrier diode. The initial starting point is the structure and underlying mathematical equations (current-voltage (I-V) relationship) for this device.

The starting point for understanding the device operation would need to introduce semiconductor materials, what their properties are and how they can be considered to behave (electrons and holes as charge carriers, intrinsic and extrinsic semiconductors, and the effects material doping [4, 5]). Based on these principles then the behaviour of the metal-

1. The behaviour of the materials around the contact junction and away from the contact junction at thermal equilibrium and non-equilibrium conditions (forward bias and

2. The differences between ohmic and rectifying contacts. It is the rectifying contact (allowing current to flow through the metal-semiconductor contact under forward bias conditions but blocking current flow under reverse bias conditions) that would be of

3. The current-voltage (I-V) relationship at forward and reverse bias conditions at the anode and cathode device terminals would be developed and the use of the diode in

11. Program (flow) control

Program (flow) control allows for the development of scripts that control how the script (program) operates depending on specific conditions. There are three types of control statement in MATLAB, along with a program termination statement: **conditional control**, **loop control**, **error control** and the program termination statement **return***.* **Conditional control** statements are *if* (together with *else* and *elseif*) and *switch* (together with *case* and *otherwise*) to execute MATLAB statements based on some logical condition. Loop control statements are *for* to execute MATLAB statements a fixed number of times, *while* to execute MATLAB statements an indefinite time based on some logical condition and *continue* to pass control to the next iteration of the *for loop* or *while loop* in which it appears and skips any remaining statements in the body of the loop. **Error control** (*try* … *catch*) changes the flow control if an error is detected during execution. The program termination statement **return** causes execution to return to the invoking function.

12. 2D and 3D plotting

MATLAB includes a large number of plotting functions which allow the user to view their data as both two-dimensional (2D) plots and three-dimensional (3D) plots.

13. MATLAB toolboxes

Whilst probably not appropriate to include in an introductory course, the MATLAB toolboxes such as Simulink and DSP toolbox provide for powerful extensions to the basic MATLAB commands and would typically be used in more advanced courses. For example, Simulink is widely used in the control engineering discipline and, with its block diagram graphical model generation approach, provides for a useful and important tool for the engineer.

14. Integration of other languages

Whilst probably not appropriate to include in an introductory course, the ability to create MATLAB scripts which interact with code developed in other languages (such as FORTAN, C/C++ and Java) provide for a useful extension and enhanced flexibility in the use of MATLAB for system modelling and analysis.

15. Graphical user interface (GUI) development

MATLAB provides for the ability to create graphical user interfaces which allow the user to interact with MATLAB through a suitable user interface rather than the command prompt or directly writing m-files.

#### 16. Dealing with terminology

Finally, as with anything that the engineer is involved in, there is a need to learn and correctly use the terminology specific to the domain that is being worked in.

## **3. Teaching and learning of semiconductor device fundamentals**

366 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

(), the imaginary unit (i or j = (-1))).

11. Program (flow) control

invoking function.

12. 2D and 3D plotting

13. MATLAB toolboxes

important tool for the engineer.

15. Graphical user interface (GUI) development

command prompt or directly writing m-files.

the use of MATLAB for system modelling and analysis.

14. Integration of other languages

16. Dealing with terminology

(value in radians), the exponential operator, the logarithmic operator, the value of pi

Program (flow) control allows for the development of scripts that control how the script (program) operates depending on specific conditions. There are three types of control statement in MATLAB, along with a program termination statement: **conditional control**, **loop control**, **error control** and the program termination statement **return***.* **Conditional control** statements are *if* (together with *else* and *elseif*) and *switch* (together with *case* and *otherwise*) to execute MATLAB statements based on some logical condition. Loop control statements are *for* to execute MATLAB statements a fixed number of times, *while* to execute MATLAB statements an indefinite time based on some logical condition and *continue* to pass control to the next iteration of the *for loop* or *while loop* in which it appears and skips any remaining statements in the body of the loop. **Error control** (*try* … *catch*) changes the flow control if an error is detected during execution. The program termination statement **return** causes execution to return to the

MATLAB includes a large number of plotting functions which allow the user to view

Whilst probably not appropriate to include in an introductory course, the MATLAB toolboxes such as Simulink and DSP toolbox provide for powerful extensions to the basic MATLAB commands and would typically be used in more advanced courses. For example, Simulink is widely used in the control engineering discipline and, with its block diagram graphical model generation approach, provides for a useful and

Whilst probably not appropriate to include in an introductory course, the ability to create MATLAB scripts which interact with code developed in other languages (such as FORTAN, C/C++ and Java) provide for a useful extension and enhanced flexibility in

MATLAB provides for the ability to create graphical user interfaces which allow the user to interact with MATLAB through a suitable user interface rather than the

Finally, as with anything that the engineer is involved in, there is a need to learn and

correctly use the terminology specific to the domain that is being worked in.

their data as both two-dimensional (2D) plots and three-dimensional (3D) plots.

For electronic and computer engineers, the use of semiconductor devices is integral to everything that they do, whether they design electronic circuits using semiconductor devices or program processors to control specific electronic circuits. Whilst practising engineers may not necessarily investigate the physics of the devices on a day-to-day basis, it is essential that they understand the behaviour of the devices at the material level (how they behave and why) in order to use these devices effectively within the electronic circuits they design or use. There are therefore two key aspects to the teaching and learning of semiconductor device fundamentals:


For example, consider an introduction to diodes. Both semiconductor (p-n junction) and Schottky barrier (metal-semiconductor contact) diodes are encountered and so must be introduced. The concepts identified in theses devices (such as a.c. signal rectification) would then be extended to more complex devices such as transistors, thyristors, triacs and integrated circuits (ICs).

Consider the Schottky barrier diode. The initial starting point is the structure and underlying mathematical equations (current-voltage (I-V) relationship) for this device. These are summarised in figure 5.

The starting point for understanding the device operation would need to introduce semiconductor materials, what their properties are and how they can be considered to behave (electrons and holes as charge carriers, intrinsic and extrinsic semiconductors, and the effects material doping [4, 5]). Based on these principles then the behaviour of the metalsemiconductor contact can be introduced and developed:


electronic circuits would be introduced and discussed. Reference would initially be made to a rectifier circuit using the diode and a resistor connected in series as shown in figure 6(a) [note that the standard diode symbol is shown here rather than the Schottky barrier diode symbol].

**Diode equations (forward and reverse bias)** 

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 369

**Figure 6.** Basic test circuits for diodes and transistors

**Simplified structure for n-type semiconductor diode** 

**Figure 5.** Schottky barrier diode summary (n-type semiconductor type)

With reference to the diode rectifier circuit (figure 6(a)), this can be modelled mathematically for both forward bias and reverse bias in MATLAB to show the principle of operation. A sample m-file for modelling and simulating the Schottky barrier diode is shown in listing 1 and the output plot is shown in figure 7. Note that this code works for versions of MATLAB after v6.5. Here:


**Figure 6.** Basic test circuits for diodes and transistors

**Figure 5.** Schottky barrier diode summary (n-type semiconductor type)

Metal

2. The resistor (*R*) is set to 2 for illustration purposes (line 15).

cycles of the sine wave are generated (lines 17 to 22).

versions of MATLAB after v6.5. Here:

when conducting (line 14).

With reference to the diode rectifier circuit (figure 6(a)), this can be modelled mathematically for both forward bias and reverse bias in MATLAB to show the principle of operation. A sample m-file for modelling and simulating the Schottky barrier diode is shown in listing 1 and the output plot is shown in figure 7. Note that this code works for

**Simplified structure for n-type semiconductor diode** 

n-type semiconductor Anode Cathode

1. An idealised diode model is created which has a forward voltage drop of 0.3 V (*Vd*)

3. A sine wave voltage source (*Vin*) is created with an amplitude of 1 V and ten complete

4. The resistor voltage drop in forward bias and reverse bias is calculated (lines 24 to 30).

6. Four sub-plots are created with time along the x-axis (lines 38 to 73). There is then a

5. The resistor current and hence the diode current (*Id*) is calculated (line 32).

delay of five seconds before the script code continues (line 74). 7. The plotted values are scrolled across the sub-plots (lines 80 to 90).

barrier diode symbol].

**VD**

Anode Cathode

**Schematic symbol with diode current and voltage in forward bias identified** 

**ID**

electronic circuits would be introduced and discussed. Reference would initially be made to a rectifier circuit using the diode and a resistor connected in series as shown in figure 6(a) [note that the standard diode symbol is shown here rather than the Schottky

> I I [e 1] (qV /nkT) <sup>D</sup> <sup>S</sup> <sup>D</sup>

> > Reverse Bias

ID IS

**Diode equations (forward and reverse bias)** 

Forward Bias

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 371

title ('\it{Time Vs Vin}', 'Color','b', 'FontWeight', 'bold');

title ('\it{Time Vs Vr}', 'Color','r', 'FontWeight', 'bold');

title ('\it{Time Vs Id}', 'Color','m', 'FontWeight', 'bold');

 end

end

In figure 7 then:

grid;

grid;

pause(5);

xlabel('Time (seconds)');

ha(3) = subplot(4,1,3);

xlabel('Time (seconds)');

ha(4) = subplot(4,1,4);

xlabel('Time (seconds)');

%% Create the scrolling plot

 refreshdata(ha(1),'caller'); refreshdata(ha(2),'caller'); refreshdata(ha(3),'caller'); refreshdata(ha(4),'caller'); axis([k (k + 3) -1.1 1.1]);

plot(Time, Vr, 'r', 'YDataSource', 'Vr');

plot(Time, Id, 'm', 'YDataSource', 'Id');

%%-------------------------------------------------

%%-------------------------------------------------

%%-------------------------------------------------

%%-------------------------------------------------

voltage across the resistor (*Vr*) are plotted on the vertical axis.

**Listing 1.** Schottky barrier diode model – MATLAB m-file code to show signal rectification

2. The top plot shows the input sine wave voltage (*Vin*) and the half-wave rectified

ylabel('Vin (V)');

ylabel('Vr (V)');

ylabel('Id (A)');

for k = 0:0.1:7

 drawnow; pause(0.5);

%% End of code

1. Time is plotted on the horizontal axis.

3. The second plot shows the input voltage (*Vin*). 4. The third plot shows the resistor voltage (*Vr*). 5. The bottom plot shows the diode current (*Id*).

linkaxes(ha, 'xy'); axis([0 3 -1.1 1.1]);

```
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
   %%-------------------------------------------------
   %% Function to create the waveforms and subplots
   %% for a Schottky diode model.
   %%-------------------------------------------------
   function Schottky_animation() 

   %%-------------------------------------------------
   %% Create the variables and equations
   %%------------------------------------------------
   clear Degrees Time R Vin Vr Vd Id; 

   Vd = 0.3; 
   R = 2; 
   for (j=0:1:9) 
    for (k=1:1:360) 
    Vin(k + (j* 360)) = 1.0 * sind(k - 1); 
    Time(k + (j* 360)) = (k + (j * 360)) / 360; 
    end
   end
   for (i=1:1:length(Vin)) 
    if (Vin(i) > 0.3) 
    Vr(i) = (Vin(i) - Vd); 
    else
    Vr(i) = 0; 
    end
   end
   Id = (Vr / R); 

   %%-------------------------------------------------
   %% Create the subplots and wait for 5 seconds
   %%------------------------------------------------
   scrsz = get(0,'ScreenSize'); 
   figure('Name', 'Ideal Schottky Diode Half-Wave Rectifier Circuit', ...
    'OuterPosition',[scrsz(3)/8 scrsz(4)/16 (3 * (scrsz(3)/4)) (15 * (scrsz(4)/16))]) 

   ha(1) = subplot(4,1,1); 
   plot(Time, Vin,'YDataSource', 'Vin'); 
   hold on; 
   grid; 
   plot(Time, Vr, 'r', 'YDataSource', 'Vr'); 
   title ('\it{Time Vs Vin & Vr}', 'Color','k', 'FontWeight', 'bold'); 
   xlabel('Time (seconds)'); 
   ylabel('Vin & Vr (V)'); 

   ha(2) = subplot(4,1,2); 
   plot(Time, Vin,'YDataSource','Vin'); 
   grid;
```
Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 371

```
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
   title ('\it{Time Vs Vin}', 'Color','b', 'FontWeight', 'bold'); 
   xlabel('Time (seconds)'); 
   ylabel('Vin (V)'); 

   ha(3) = subplot(4,1,3); 
   plot(Time, Vr, 'r', 'YDataSource', 'Vr'); 
   grid; 
   title ('\it{Time Vs Vr}', 'Color','r', 'FontWeight', 'bold'); 
   xlabel('Time (seconds)'); 
   ylabel('Vr (V)'); 

   ha(4) = subplot(4,1,4); 
   plot(Time, Id, 'm', 'YDataSource', 'Id'); 
   grid; 
   title ('\it{Time Vs Id}', 'Color','m', 'FontWeight', 'bold'); 
   xlabel('Time (seconds)'); 
   ylabel('Id (A)'); 
   linkaxes(ha, 'xy'); 
   axis([0 3 -1.1 1.1]); 
   pause(5); 
   %%-------------------------------------------------
   %% Create the scrolling plot
   %%-------------------------------------------------
   for k = 0:0.1:7 

    refreshdata(ha(1),'caller'); 
    refreshdata(ha(2),'caller'); 
    refreshdata(ha(3),'caller'); 
    refreshdata(ha(4),'caller'); 
    axis([k (k + 3) -1.1 1.1]); 
    drawnow; 
    pause(0.5); 

   end
   end 
   %%-------------------------------------------------
   %% End of code
   %%-------------------------------------------------
```
**Listing 1.** Schottky barrier diode model – MATLAB m-file code to show signal rectification

In figure 7 then:

370 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

%%------------------------------------------------- %% Function to create the waveforms and subplots

%%-------------------------------------------------

%%-------------------------------------------------

%%------------------------------------------------

 Vin(k + (j\* 360)) = 1.0 \* sind(k - 1); Time(k + (j\* 360)) = (k + (j \* 360)) / 360;

%%------------------------------------------------- %% Create the subplots and wait for 5 seconds %%------------------------------------------------

figure('Name', 'Ideal Schottky Diode Half-Wave Rectifier Circuit', ... 'OuterPosition',[scrsz(3)/8 scrsz(4)/16 (3 \* (scrsz(3)/4)) (15 \* (scrsz(4)/16))])

title ('\it{Time Vs Vin & Vr}', 'Color','k', 'FontWeight', 'bold');

%% for a Schottky diode model.

function Schottky\_animation()

%% Create the variables and equations

clear Degrees Time R Vin Vr Vd Id;

Vd = 0.3; R = 2;

 end end

else

 end end

grid;

hold on; grid;

for (j=0:1:9) for (k=1:1:360)

for (i=1:1:length(Vin)) if (Vin(i) > 0.3)

Vr(i) = 0;

Id = (Vr / R);

Vr(i) = (Vin(i) - Vd);

scrsz = get(0,'ScreenSize');

plot(Time, Vin,'YDataSource', 'Vin');

plot(Time, Vin,'YDataSource','Vin');

plot(Time, Vr, 'r', 'YDataSource', 'Vr');

ha(1) = subplot(4,1,1);

xlabel('Time (seconds)'); ylabel('Vin & Vr (V)');

ha(2) = subplot(4,1,2);


When the plot scrolls, after an initial delay of five seconds, it shows a similar waveform to that which would be seen on an oscilloscope display; it would be seen here that as time increments, the viewed waveforms scrolls across the screen. This shows how theoretical models can be created and analysed in MATLAB. Simulation however is only part of the overall story. Relating theory to the "real world" requires suitable the *design*, *build* and *test* of real circuits. Then, MATLAB could be used to analyse the results from a physical circuit prototype, and the theoretical model and practical circuits could be compared.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 373

(both N-channel an P-channel types) and finally, figure 6(d) shows a test circuit for a junction field effect transistor (both N-channel an P-channel types). These test circuits are suitable for the experimentation arrangements considered here. However, it is possible to create different test set-ups given the availability of suitable test and measurement

3. Damage to the devices would not occur in the physical test set-up if specified and used

Device damage would not occur in a simulated mathematical model, but could occur in a real device. For example, in N-channel JFET circuits, the gate-source voltage is to be zero or negative for correct device operation with the drain-source voltage zero or positive. The gate resistor (Rg) is included here to ensure that if a positive gate-source voltage were to be applied then the current through the JFET gate node would be limited to a safe value by suitable choice of the resistor value. When gate-source voltage is to be zero or negative, no current flows through the transistor gate (the p-n junction created is reverse biased) and for d.c. gate-source voltages, the resistor has no effect (although for a.c. signals the value of the

This section will describe the use of the experiment via a traditional laboratory scenario. In this arrangement, the student builds a test circuit (either using a suitable solderless prototyping board or physically soldering the components to a suitable printed circuit board (PCB)) and runs a number of electrical tests on the electronic circuit. The tests are chosen to operate the particular device under the modes of operation that are of interest for the student to investigate. Once the tests have been completed, the student would plot the results (by-hand) on graph paper and then import the results into MATLAB for analysis and computer based graphing of the results. Here, it would then be possible to consider the physical process of setting-up an experiment, running the experiment and taking results before utilising a suitable mathematics tool for analysis purposes. However, the traditional *manual* way of plotting the graph from experiment data is slow and sometimes not convenient. Both the idealised (theoretical mathematical equation model) and the operation of an actual semiconductor device could then be analysed and compared, with differences between the practical device test results and idealised models analysed using MATLAB. Using the analysis tool to analyse the behaviour of and to plot the experiment data means

that various analyses can be performed on the data and the results quickly plotted.

Within the teaching and learning of semiconductor device fundamentals, the basic devices to initially introduce to the student are the diode and transistor. To illustrate this, figure 8 shows the device to discuss here, the Schottky barrier diode. The circuit here shows the BAT86 Schottky barrier diode in a forward bias mode of operation. In this mode of operation, when the input voltage applied is positive, the diode will allow the flow of

2. The applied voltages operate the devices in the intended modes of operation.

correctly (maximum device ratings are never encountered or exceeded).

equipment. Care however has to be taken in order to ensure that:

1. Suitable device types are used.

resistor would affect the circuit operation).

**4. Case study 1: The traditional learning scenario** 

**Figure 7.** Schottky barrier diode model – MATLAB plot from listing 1

In more general terms, the above discussion flow would be extended to any semiconductor device, given the ability to create and measure the required range of voltage levels. For example, figure 6(b) shows a test circuit for a bipolar junction transistor (both npn and pnp types), figure 6(c) shows a test circuit for a metal oxide semiconductor field effect transistor (both N-channel an P-channel types) and finally, figure 6(d) shows a test circuit for a junction field effect transistor (both N-channel an P-channel types). These test circuits are suitable for the experimentation arrangements considered here. However, it is possible to create different test set-ups given the availability of suitable test and measurement equipment. Care however has to be taken in order to ensure that:

1. Suitable device types are used.

372 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

prototype, and the theoretical model and practical circuits could be compared.

**Figure 7.** Schottky barrier diode model – MATLAB plot from listing 1

In more general terms, the above discussion flow would be extended to any semiconductor device, given the ability to create and measure the required range of voltage levels. For example, figure 6(b) shows a test circuit for a bipolar junction transistor (both npn and pnp types), figure 6(c) shows a test circuit for a metal oxide semiconductor field effect transistor

When the plot scrolls, after an initial delay of five seconds, it shows a similar waveform to that which would be seen on an oscilloscope display; it would be seen here that as time increments, the viewed waveforms scrolls across the screen. This shows how theoretical models can be created and analysed in MATLAB. Simulation however is only part of the overall story. Relating theory to the "real world" requires suitable the *design*, *build* and *test* of real circuits. Then, MATLAB could be used to analyse the results from a physical circuit


Device damage would not occur in a simulated mathematical model, but could occur in a real device. For example, in N-channel JFET circuits, the gate-source voltage is to be zero or negative for correct device operation with the drain-source voltage zero or positive. The gate resistor (Rg) is included here to ensure that if a positive gate-source voltage were to be applied then the current through the JFET gate node would be limited to a safe value by suitable choice of the resistor value. When gate-source voltage is to be zero or negative, no current flows through the transistor gate (the p-n junction created is reverse biased) and for d.c. gate-source voltages, the resistor has no effect (although for a.c. signals the value of the resistor would affect the circuit operation).

## **4. Case study 1: The traditional learning scenario**

This section will describe the use of the experiment via a traditional laboratory scenario. In this arrangement, the student builds a test circuit (either using a suitable solderless prototyping board or physically soldering the components to a suitable printed circuit board (PCB)) and runs a number of electrical tests on the electronic circuit. The tests are chosen to operate the particular device under the modes of operation that are of interest for the student to investigate. Once the tests have been completed, the student would plot the results (by-hand) on graph paper and then import the results into MATLAB for analysis and computer based graphing of the results. Here, it would then be possible to consider the physical process of setting-up an experiment, running the experiment and taking results before utilising a suitable mathematics tool for analysis purposes. However, the traditional *manual* way of plotting the graph from experiment data is slow and sometimes not convenient. Both the idealised (theoretical mathematical equation model) and the operation of an actual semiconductor device could then be analysed and compared, with differences between the practical device test results and idealised models analysed using MATLAB. Using the analysis tool to analyse the behaviour of and to plot the experiment data means that various analyses can be performed on the data and the results quickly plotted.

Within the teaching and learning of semiconductor device fundamentals, the basic devices to initially introduce to the student are the diode and transistor. To illustrate this, figure 8 shows the device to discuss here, the Schottky barrier diode. The circuit here shows the BAT86 Schottky barrier diode in a forward bias mode of operation. In this mode of operation, when the input voltage applied is positive, the diode will allow the flow of

current through the load resistor and the diode will have a voltage drop of approximately 0.3 V when conducting (the actual device voltage drop being dependent on the level of current flowing through the diode). If the diode is connected in the reverse direction, the reverse bias mode of operation will be encountered and the diode will block the flow of current until a reverse bias junction breakdown voltage is encountered at which point the diode will conduct current. In reverse bias junction breakdown, if the current flow is not limited then damage to the diode will occur.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 375

The current-voltage (I-V) relationship that should be encountered during an experiment is that as shown in figure 9. The regions of operation of interest are the forward bias (to the right of the ID-axis) and the reverse bias (to the left of the ID-axis) prior to reverse bias

**Diode current, ID (A)** 

**Reverse Bias Forward Bias** 

**Figure 9.** Schottky diode I-V characteristic (before reverse bias junction breakdown is encountered)

<sup>D</sup> <sup>S</sup> I I **0.3 V** 

calculation of the diode current for set values of diode voltage.

parameters can be identified. These are summarised in table 1.

In forward bias, the diode current increases in an exponential manner with a linear increase in diode voltage. The diode voltage is around 0.3 V when current flows through the device, the exact value of diode voltage dependent on the value of the diode current. In reverse bias and prior to reverse bias breakdown occurring, the diode current is essentially independent of the diode voltage and is approximately the value of the saturation current (IS). This effect can readily be modelled in MATLAB as shown in listing 2, here using the *for loop* in the

For comparison purposes, from the BAT86 Schottky barrier diode datasheet, the diode

Forward bias voltage drop Forward current = 0.1 mA 300 mV

Reverse bias current Reverse bias voltage = 40 V 5 A **Table 1.** BAT86 Schottky barrier diode [2] datasheet forward and reverse bias parameters

Parameter Conditions Maximum value

Forward current = 1 mA 380 mV Forward current = 10 mA 450 mV Forward current = 30 mA 600 mV Forward current = 100 mA 900 mV

I I [e 1] (qV /nkT) <sup>D</sup> <sup>S</sup> <sup>D</sup>

> **Diode voltage, VD (V)**

junction breakdown.

**Forward bias** 

**Reverse bias** 

**Figure 8.** BAT86 Schottky diode experiment (forward bias)

The I-V mathematical model characteristic of the diode in figure 9 shows both the expected forward and reverse bias modes of operation and the ideal device equation are also noted:

Forward bias:

$$\mathbf{I}\_{\rm D} = \mathbf{I}\_{\rm S} \left[ \mathbf{e}^{\rm (qV\_{\rm D}/nkT)} - 1 \right]$$

Reverse bias (prior to breakdown):

D S I I

Here:


The current-voltage (I-V) relationship that should be encountered during an experiment is that as shown in figure 9. The regions of operation of interest are the forward bias (to the right of the ID-axis) and the reverse bias (to the left of the ID-axis) prior to reverse bias junction breakdown.

374 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

limited then damage to the diode will occur.

**Figure 8.** BAT86 Schottky diode experiment (forward bias)

Forward bias:

Here:

Reverse bias (prior to breakdown):

ID is the diode current.

k is Botzmann's constant.

 IS is the diode saturation current. q is the charge on an electron.

 VD is the forward bias diode voltage drop. n is the ideality factor and is set to 1.

T is the temperature in degrees Kelvin.

current through the load resistor and the diode will have a voltage drop of approximately 0.3 V when conducting (the actual device voltage drop being dependent on the level of current flowing through the diode). If the diode is connected in the reverse direction, the reverse bias mode of operation will be encountered and the diode will block the flow of current until a reverse bias junction breakdown voltage is encountered at which point the diode will conduct current. In reverse bias junction breakdown, if the current flow is not

The I-V mathematical model characteristic of the diode in figure 9 shows both the expected forward and reverse bias modes of operation and the ideal device equation are also noted:

> <sup>D</sup> (qV /nkT) D S I Ie 1

> > D S I I

**Figure 9.** Schottky diode I-V characteristic (before reverse bias junction breakdown is encountered)

In forward bias, the diode current increases in an exponential manner with a linear increase in diode voltage. The diode voltage is around 0.3 V when current flows through the device, the exact value of diode voltage dependent on the value of the diode current. In reverse bias and prior to reverse bias breakdown occurring, the diode current is essentially independent of the diode voltage and is approximately the value of the saturation current (IS). This effect can readily be modelled in MATLAB as shown in listing 2, here using the *for loop* in the calculation of the diode current for set values of diode voltage.

For comparison purposes, from the BAT86 Schottky barrier diode datasheet, the diode parameters can be identified. These are summarised in table 1.


**Table 1.** BAT86 Schottky barrier diode [2] datasheet forward and reverse bias parameters

In listing 2, both the forward bias mode of operation and the reverse bias mode of operation are modelled and plotted, where:

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 377

These values and equations can be entered into MATLAB and plots of the I-V characteristic can be produced (by adding code for plotting the results to the code shown in listing 2).

Figure 10 shows a figure where the forward and reverse bias diode characteristics are plotted. The top subplot shows the forward and reverse bias characteristic (VD shown from - 10 V to +0.6 V) and the bottom two subplots show the forward bias characteristic zooming in on different ranges of VD. Hence, specific areas of device operation can easily be identified from the overall set of data and individual plots created for understanding and analysis

The experiment can then be prototyped on a solderless prototyping board as shown in figure 11. Connecting this circuit to a dual d.c. power supply and digital voltmeter will provide all the necessary circuitry and equipment to undertake the experiment shown in figure 8. Table 2 shows the forward bias results (measuring *Vin* and *Vr*, and calculating *Vd* and *Id*). Table 3 shows the reverse bias results. Both sets of diode currents are calculated using the calculated resistor current and the actual measured resistor value

purposes.

(*Rm = 997* 

)

**Figure 10.** Ideal Schottky barrier diode equation plots


One way in which the ideal device equations can be modelled in MATLAB is shown in listing 2:

```
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
   %%--------------------------------------------------------------------- 
   %%-- Schottky barrier diode forward bias equation 
   %%-- x-axis scaling (voltage) from 0 V to +0.8 V 
   %%--------------------------------------------------------------------- 
           Vd_forward = (0:0.01:0.8) 
           T = 300 
           k = 1.38066e-23 
           q = 1.60218e-19 
           Is_sch = 1e-9 
           n = 1.0 
           for i=(1:1:length(Vd_forward)) 

            Id_forward = Is_sch * (exp((q * Vd_forward)/(n * k * T)) - 1) 
           end 
   %%--------------------------------------------------------------------- 
   %%-- Schottky barrier diode reverse bias equation 
   %%-- x-axis scaling (voltage) from 0 V to -10.0 V 
   %%--------------------------------------------------------------------- 
           Vd_reverse = (0:-0.01:-10.0) 
           Is_sch = 1e-9 
           for i = (1:1:length(Vd_reverse)) 

            Id_reverse = -Is_sch 
           end 
   %%--------------------------------------------------------------------- 
   %% End of code 
   %%---------------------------------------------------------------------
```
**Listing 2.** Calculating the forward and reverse bias operation of the Schottky diode

These values and equations can be entered into MATLAB and plots of the I-V characteristic can be produced (by adding code for plotting the results to the code shown in listing 2).

376 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

%%-- Schottky barrier diode forward bias equation %%-- x-axis scaling (voltage) from 0 V to +0.8 V

Vd\_forward = (0:0.01:0.8)

for i=(1:1:length(Vd\_forward))

%%-- Schottky barrier diode reverse bias equation %%-- x-axis scaling (voltage) from 0 V to -10.0 V

Vd\_reverse = (0:-0.01:-10.0)

Id\_reverse = -Is\_sch

for i = (1:1:length(Vd\_reverse))

**Listing 2.** Calculating the forward and reverse bias operation of the Schottky diode

are modelled and plotted, where:

T = 300

%% End of code

end

end

k = 1.38066e-23 q = 1.60218e-19

Is\_sch = 1e-9 n = 1.0

Is\_sch = 1e-9

listing 2:

 The forward bias voltage is *Vd\_forward*. The forward bias current is *Id\_forward*. The reverse bias voltage is *Vd\_reverse*. The reverse bias current is *Id\_ reverse*.

In listing 2, both the forward bias mode of operation and the reverse bias mode of operation

One way in which the ideal device equations can be modelled in MATLAB is shown in

%%---------------------------------------------------------------------

%%---------------------------------------------------------------------

Id\_forward = Is\_sch \* (exp((q \* Vd\_forward)/(n \* k \* T)) - 1)

%%---------------------------------------------------------------------

%%---------------------------------------------------------------------

%%---------------------------------------------------------------------

%%---------------------------------------------------------------------

Figure 10 shows a figure where the forward and reverse bias diode characteristics are plotted. The top subplot shows the forward and reverse bias characteristic (VD shown from - 10 V to +0.6 V) and the bottom two subplots show the forward bias characteristic zooming in on different ranges of VD. Hence, specific areas of device operation can easily be identified from the overall set of data and individual plots created for understanding and analysis purposes.

The experiment can then be prototyped on a solderless prototyping board as shown in figure 11. Connecting this circuit to a dual d.c. power supply and digital voltmeter will provide all the necessary circuitry and equipment to undertake the experiment shown in figure 8. Table 2 shows the forward bias results (measuring *Vin* and *Vr*, and calculating *Vd* and *Id*). Table 3 shows the reverse bias results. Both sets of diode currents are calculated using the calculated resistor current and the actual measured resistor value (*Rm = 997* )

**Figure 10.** Ideal Schottky barrier diode equation plots

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 379

**Calculated** (to nearest 1 mV)

**Calculated**  (to nearest 1 µA)

Vin (V) Vr (V) Vd = (Vin – Vr) (V) Id = Ir = (Vr / Rm) (A)

0 0 0 0

0.5 0.268 0.232 269 µA 1.0 0.739 0.261 741 µA 1.5 1.223 0.277 1.227 mA 2.0 1.712 0.288 1.717 mA 2.5 2.204 0.296 2.211 mA 3.0 2.697 0.303 2.705 mA 3.5 3.190 0.310 3.200 mA 4.0 3.685 0.315 3.696 mA 4.5 4.180 0.320 4.193 mA 5.0 4.675 0.325 4.689 mA 5.5 5.170 0.330 5.186 mA 6.0 5.666 0.334 5.683 mA 6.5 6.162 0.338 6.181 mA 7.0 6.659 0.341 6.679 mA 7.5 7.155 0.345 7.177 mA 8.0 7.651 0.349 7.674 mA 8.5 8.148 0.352 8.173 mA 9.0 8.645 0.355 8.671 mA 9.5 9.141 0.349 9.169 mA 10.0 9.637 0.363 9.666 mA

**Measured Measured**

**Table 2.** Diode forward bias test results

(to nearest 1 mV)

**Figure 11.** Prototyping the experiment

The measured values of voltage (*Vin* and *Vr*) can be entered into MATLAB and the diode voltage and current (*Vd* and *Id*) can then be calculated. The results can be entered into MATLAB and plotted with the MATLAB m-file code as shown in listing 3. Note also that the actual resistance value (*Rm*) of the 1 k resistor was used in the current calculation in order to account for the tolerance of the resistor used. Figure 12 shows the resulting MATLAB plot with the forward bias shown on the top sub-plot and the both forward and reverse bias shown on the bottom sub-plot.


**Table 2.** Diode forward bias test results

**Figure 11.** Prototyping the experiment

reverse bias shown on the bottom sub-plot.

The measured values of voltage (*Vin* and *Vr*) can be entered into MATLAB and the diode voltage and current (*Vd* and *Id*) can then be calculated. The results can be entered into MATLAB and plotted with the MATLAB m-file code as shown in listing 3. Note also that the actual resistance value (*Rm*) of the 1 k resistor was used in the current calculation in order to account for the tolerance of the resistor used. Figure 12 shows the resulting MATLAB plot with the forward bias shown on the top sub-plot and the both forward and


Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 381

Vin = [0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10]

Vr\_forward = [0 0.268 0.739 1.223 1.712 2.204 2.697 3.190 3.685 4.180 ... 4.675 5.170 5.666 6.162 6.659 7.155 7.651 8.148 8.645 9.141 9.637]

title('Vd Vs Id for measured BAT86 Schottky Barrier Diode (forward bias)')

%%------------------------------------------------------------------------

%%------------------------------------------------------------------------

**Listing 3.** M-file code for entering and plotting the test results for the BAT86 Schottky barrier diode

title('Vd Vs Id for measured BAT86 Schottky Barrier Diode')

%%-------------------------------------

%%-------------------------------------

%%-------------------------------------

%%-------------------------------------

%%-------------------------------------

%%-------------------------------------

plot(Vd\_forward, Id\_forward, 'k')

plot(Vd\_forward, Id\_forward, 'o')

plot(Vd\_forward, Id\_forward, 'k')

plot(Vd\_forward, Id\_forward, 'o')

plot(Vd\_reverse, Id\_reverse, 'r') plot(Vd\_reverse, Id\_reverse, 'o')

%%-- End of BAT86 Schottky barrier diode test

Vr\_reverse = [0 0 0 0 0 0 0 0 0 0 0 0 ...

Vd\_forward = (Vin - Vr\_forward) Id\_forward = (Vr\_forward / Rm)

Vd\_reverse = -(Vin - Vr\_reverse) Id\_reverse = -(Vr\_reverse / Rm)

%% Diode in forward bias

%% Diode in reverse bias

0 0 0 0 0 0 0 0 0]

%% Plot results

subplot(2, 1, 1)

xlabel('Vd (V)') ylabel('Id (A)')

subplot(2, 1, 2)

xlabel('Vd (V)') ylabel('Id (A)')

hold on grid

hold on grid


```
1 
2 
3 
4 
5 
6 
7 
8 
9 
   %%-----------------------------------------------------------------------
   %%-- BAT86 Schottky barrier diode test
   %%-----------------------------------------------------------------------
   %%-------------------------------------
   %% Test conditions
   %%-------------------------------------
   Rm = 997
```
**Measured Measured**

**Table 3.** Diode reverse bias test results

%% Test conditions

Rm = 997

%%-- BAT86 Schottky barrier diode test

%%-------------------------------------

%%-------------------------------------

(to nearest 1 mV)

Vin (V) Vr (V) Vd = -(Vin – Vr) (V) Id = -Ir = -(Vr / Rm) (A)

0 0 -0 0 0.5 0 -0.5 0 1.0 0 -1.0 0 1.5 0 -1.5 0 2.0 0 -2.0 0 2.5 0 -2.5 0 3.0 0 -3.0 0 3.5 0 -3.5 0 4.0 0 -4.0 0 4.5 0 -4.5 0 5.0 0 -5.0 0 5.5 0 -5.5 0 6.0 0 -6.0 0 6.5 0 -6.5 0 7.0 0 -7.0 0 7.5 0 -7.5 0 8.0 0 -8.0 0 8.5 0 -8.5 0 9.0 0 -9.0 0 9.5 0 -9.5 0 10.0 0 -10.0 0

%%-----------------------------------------------------------------------

%%-----------------------------------------------------------------------

**Calculated** (to nearest 1 mV)

**Calculated**  (to nearest 1 µA)

```
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
37 
38 
39 
40 
41 
42 
43 
44 
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 

   Vin = [0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 7 7.5 8 8.5 9 9.5 10] 

   %%-------------------------------------
   %% Diode in forward bias
   %%-------------------------------------
   Vr_forward = [0 0.268 0.739 1.223 1.712 2.204 2.697 3.190 3.685 4.180 ...
    4.675 5.170 5.666 6.162 6.659 7.155 7.651 8.148 8.645 9.141 9.637] 

   Vd_forward = (Vin - Vr_forward) 
   Id_forward = (Vr_forward / Rm) 

   %%-------------------------------------
   %% Diode in reverse bias
   %%-------------------------------------
   Vr_reverse = [0 0 0 0 0 0 0 0 0 0 0 0 ...
    0 0 0 0 0 0 0 0 0] 

   Vd_reverse = -(Vin - Vr_reverse) 
   Id_reverse = -(Vr_reverse / Rm) 

   %%-------------------------------------
   %% Plot results
   %%-------------------------------------
   subplot(2, 1, 1) 
   plot(Vd_forward, Id_forward, 'k') 
   hold on
   grid 
   plot(Vd_forward, Id_forward, 'o') 

   title('Vd Vs Id for measured BAT86 Schottky Barrier Diode (forward bias)') 
   xlabel('Vd (V)') 
   ylabel('Id (A)') 

   subplot(2, 1, 2) 
   plot(Vd_forward, Id_forward, 'k') 
   hold on
   grid 
   plot(Vd_forward, Id_forward, 'o') 

   plot(Vd_reverse, Id_reverse, 'r') 
   plot(Vd_reverse, Id_reverse, 'o') 

   title('Vd Vs Id for measured BAT86 Schottky Barrier Diode') 
   xlabel('Vd (V)') 
   ylabel('Id (A)') 

   %%------------------------------------------------------------------------
   %%-- End of BAT86 Schottky barrier diode test
   %%------------------------------------------------------------------------
```
**Listing 3.** M-file code for entering and plotting the test results for the BAT86 Schottky barrier diode

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 383

This section will describe the use of the experiment via a computer interface. In this arrangement, the student does not build the circuit – the circuit experiment is pre-built and connected to a computer via a suitable computer serial port. In this discussion, the RS-232 serial port is used and this interfaces to the diode experiment via an interface circuit consisting of a suitably configured Spartan-3 field programmable gate array (FPGA) [6, 7] and digital-to-analogue converter (DAC) and analogue-to-digital converter (ADC)

Here, the PC connects to an FPGA prototyping board via an RS-232 interface. The FPGA prototyping board also houses a voltage level shifter circuit (the MAX3232 IC) to interface the RS-232 voltage levels to the FPGA +3.3 V power supply voltage levels. Digital inputs and outputs (I/O) of the FPGA then connect to an analogue I/O board. This houses a power supply, two DACs (providing two independent voltage outputs in the range -10 V to +10 V) and two ADCs (receiving two input voltages in the range 0 V to +10 V). The

**5. Case study 2: Computer aided learning scenario** 

This structure of the hardware and software interface is shown in figure 13.

arrangement.

**Figure 13.** Tester hardware interface set-up

**Figure 12.** BAT86 Schottky barrier diode test results (forward and reverse bias)

In order to create the plots then there are three main parts to the m-file:

	- a. The measured resistor value (*Rm*) (line 9).
	- b. The input voltage values (*Vin*) (line 11).
	- c. The measured resistor voltage with the diode in forward bias (*Vr\_forward*) (lines 17 and 18).
	- d. The measured resistor voltage with the diode in reverse bias (*Vr\_reverse*) (lines 27 and 28).
	- a. The diode voltage in forward bias (*Vd\_forward*) (line 20).
	- b. The diode current in forward bias (*Id\_forward*) (line 21).
	- c. The diode voltage in reverse bias (*Vd\_reverse*) (line 30).
	- d. The diode current in reverse bias (*Id\_reverse*) (line 31).

## **5. Case study 2: Computer aided learning scenario**

382 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 12.** BAT86 Schottky barrier diode test results (forward and reverse bias)

In order to create the plots then there are three main parts to the m-file:

a. The measured resistor value (*Rm*) (line 9). b. The input voltage values (*Vin*) (line 11).

and 18).

28).

1. Entering the device test data (measured values) as scalar values and arrays:

2. Creating the equations to determine the diode voltage and current values:

3. Plotting the currents and voltages on a single figure using subplots (lines 37 to 58).

a. The diode voltage in forward bias (*Vd\_forward*) (line 20). b. The diode current in forward bias (*Id\_forward*) (line 21). c. The diode voltage in reverse bias (*Vd\_reverse*) (line 30). d. The diode current in reverse bias (*Id\_reverse*) (line 31).

c. The measured resistor voltage with the diode in forward bias (*Vr\_forward*) (lines 17

d. The measured resistor voltage with the diode in reverse bias (*Vr\_reverse*) (lines 27 and

This section will describe the use of the experiment via a computer interface. In this arrangement, the student does not build the circuit – the circuit experiment is pre-built and connected to a computer via a suitable computer serial port. In this discussion, the RS-232 serial port is used and this interfaces to the diode experiment via an interface circuit consisting of a suitably configured Spartan-3 field programmable gate array (FPGA) [6, 7] and digital-to-analogue converter (DAC) and analogue-to-digital converter (ADC) arrangement.

This structure of the hardware and software interface is shown in figure 13.

**Figure 13.** Tester hardware interface set-up

Here, the PC connects to an FPGA prototyping board via an RS-232 interface. The FPGA prototyping board also houses a voltage level shifter circuit (the MAX3232 IC) to interface the RS-232 voltage levels to the FPGA +3.3 V power supply voltage levels. Digital inputs and outputs (I/O) of the FPGA then connect to an analogue I/O board. This houses a power supply, two DACs (providing two independent voltage outputs in the range -10 V to +10 V) and two ADCs (receiving two input voltages in the range 0 V to +10 V). The

analogue I/O board consists of a custom made printed circuit board (PCB) with an onboard BAT86 Schottky barrier diode experiment and a connector to interface to additional experiments.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 385

%-----------------------------------------------------------------% % MATLAB template file for BAT86 Schottky barrier diode experiment.

%-----------------------------------------------------------------%

%-----------------------------------------------------------------%

%-----------------------------------------------------------------%

% BAT86 Forward Bias mode of operation.

% Experiment undertaken on 13/01/2012 14:25:43

**Figure 15.** User interface GUI

R = 1e+3

Vin = [0, 0, 0]

%%------------------- %% Test Results %%-------------------

Vr = [0.00, 0.00, 0.00]

**Listing 4.** Automatically generated m-file template

%%------------------- %% Analysis section %%-------------------

Figure 14 shows the manufactured PCB in more detail. It is of course possible to utilise an existing hardware arrangement rather than designing a custom made solution.

In addition, the computer runs a suitably designed software application which gives the user access to the tester hardware. It is possible to use any suitable programming language (including the MATLAB GUI (Graphical User Interface) builder) to provide for a user interface and suitable software applications to access to the computer RS-232 port. However, here, a Visual Basic [8] application was used with Visual Basic here being the language of preference. Figure 15 shows the GUI as designed. The user selects the experiment (diode in forward bias or reverse bias mode of operation) and then runs a test by setting the input voltage (*Vin*) to apply to the circuit and then sending this to the experiment. The results from the experiment then are displayed on the GUI.

**Figure 14.** Analogue I/O board PCB

On completion of the experiment, the experiment results are saved into an automatically generated MATLAB m-file template (essentially the input and output voltages are saved in arrays in the m-file). The user then edits the m-file (adding his or her own results analysis and plotting commands), and runs MATLAB to analyse the test results. Listing 4 shows an example m-file template automatically generated by the software application.

#### Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 385


**Figure 15.** User interface GUI

384 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

existing hardware arrangement rather than designing a custom made solution.

from the experiment then are displayed on the GUI.

**Figure 14.** Analogue I/O board PCB

experiments.

analogue I/O board consists of a custom made printed circuit board (PCB) with an onboard BAT86 Schottky barrier diode experiment and a connector to interface to additional

Figure 14 shows the manufactured PCB in more detail. It is of course possible to utilise an

In addition, the computer runs a suitably designed software application which gives the user access to the tester hardware. It is possible to use any suitable programming language (including the MATLAB GUI (Graphical User Interface) builder) to provide for a user interface and suitable software applications to access to the computer RS-232 port. However, here, a Visual Basic [8] application was used with Visual Basic here being the language of preference. Figure 15 shows the GUI as designed. The user selects the experiment (diode in forward bias or reverse bias mode of operation) and then runs a test by setting the input voltage (*Vin*) to apply to the circuit and then sending this to the experiment. The results

On completion of the experiment, the experiment results are saved into an automatically generated MATLAB m-file template (essentially the input and output voltages are saved in arrays in the m-file). The user then edits the m-file (adding his or her own results analysis and plotting commands), and runs MATLAB to analyse the test results. Listing 4 shows an

example m-file template automatically generated by the software application.

**Listing 4.** Automatically generated m-file template

The equipment set-up is shown in figure 16. Here, a laptop PC runs the software application and interfaces to the FPGA prototyping board via an RS-232 serial data link. The analogue I/O board operates on a +/-15 V d.c. power supply and test points are provided on the board to allow for the measurement of specific circuit voltages. The BAT86 Schottky barrier diode experiment is also incorporated on the analogue I/O (experiment) board.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 387

**6. Case study 3: Distance education learning scenario** 

not tell the whole story.

education through to E-Science applications [11].

Increasingly, universities are providing access to courses in a distance mode of operation – that is students are not physically located within the institution, but learn from an alternative (remote) location. In the simplest terms, students are registered to study for a qualification within the institution but access course material (lecture notes and assignments) via a suitable Internet connection and learning management system (LMS) such as Moodle [9] or a custom LMS solution. However, such a simplistic statement does

In engineering and science, there is a need to undertake experiments and analyse experiment results. This is traditionally undertaken *at-presence* where the learner undertakes the experiment within the laboratory facilities hosted by the institution. This approach might not be possible for distance learners and so alternative approaches to providing access to experimentation have been developed – distance learning utilising remote experimentation accessed through a remote laboratory [10]. The role that distance learning now undertakes within the teaching and learning environments on a global scale has gained widespread acceptance over the last number of years. Textural based teaching material, enhanced with graphics and animation, is now supported through the use of remote experimentation. Remote experimentation is essentially physical laboratory experiments that are set-up to be accessible via the Internet. Many institutions and organisations now provide for their laboratory experimentation to be Internet-enabled, so providing access via a web browser for remote users who may be in a location in the world that provides the user with an Internet access capability. This has been shown to be of high value from university

Industry can also benefit from the concept of distance access and learning scenario. Imagine for example, a parent company which has invested heavily in expensive equipment, for example integrated circuit (IC) testers. When the company extends its operations into other locations, it does not then need not to invest in the same equipment again. This is where the remote logging into the tester for device testing and data collection purposes can be done, and the analysis can carried out using MATLAB. In another scenario, the after sales service of a product can be made more friendly, easier and cost effective. In traditional approach, when a machine is down (i.e., not operational due to a fault), the customer has to wait for the service engineer to arrive from another part of the world to repair the machine. Using the concept of distance access, the service engineer needs only to be remotely connected to the down machine and MATLAB can once again be useful to analysis the symptoms and suggest possible causes, along with solutions. Of course the symptom has to be first

Here and in this distance based learning scenario, the basic experimentation set-up and discussed in section 5 (Case study 2: computer aided learning scenario) can be modified to be accessible via the Internet. Essentially, a web-server arrangement (a WAMP (Windows, Apache [12], MySQL [13] and PHP [14])) system is set-up here and the experiment user

modelled accurately just like the diode and other devices are modelled.

**Figure 16.** Computer set-up

## **6. Case study 3: Distance education learning scenario**

386 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

experiment is also incorporated on the analogue I/O (experiment) board.

**Figure 16.** Computer set-up

The equipment set-up is shown in figure 16. Here, a laptop PC runs the software application and interfaces to the FPGA prototyping board via an RS-232 serial data link. The analogue I/O board operates on a +/-15 V d.c. power supply and test points are provided on the board to allow for the measurement of specific circuit voltages. The BAT86 Schottky barrier diode

Increasingly, universities are providing access to courses in a distance mode of operation – that is students are not physically located within the institution, but learn from an alternative (remote) location. In the simplest terms, students are registered to study for a qualification within the institution but access course material (lecture notes and assignments) via a suitable Internet connection and learning management system (LMS) such as Moodle [9] or a custom LMS solution. However, such a simplistic statement does not tell the whole story.

In engineering and science, there is a need to undertake experiments and analyse experiment results. This is traditionally undertaken *at-presence* where the learner undertakes the experiment within the laboratory facilities hosted by the institution. This approach might not be possible for distance learners and so alternative approaches to providing access to experimentation have been developed – distance learning utilising remote experimentation accessed through a remote laboratory [10]. The role that distance learning now undertakes within the teaching and learning environments on a global scale has gained widespread acceptance over the last number of years. Textural based teaching material, enhanced with graphics and animation, is now supported through the use of remote experimentation. Remote experimentation is essentially physical laboratory experiments that are set-up to be accessible via the Internet. Many institutions and organisations now provide for their laboratory experimentation to be Internet-enabled, so providing access via a web browser for remote users who may be in a location in the world that provides the user with an Internet access capability. This has been shown to be of high value from university education through to E-Science applications [11].

Industry can also benefit from the concept of distance access and learning scenario. Imagine for example, a parent company which has invested heavily in expensive equipment, for example integrated circuit (IC) testers. When the company extends its operations into other locations, it does not then need not to invest in the same equipment again. This is where the remote logging into the tester for device testing and data collection purposes can be done, and the analysis can carried out using MATLAB. In another scenario, the after sales service of a product can be made more friendly, easier and cost effective. In traditional approach, when a machine is down (i.e., not operational due to a fault), the customer has to wait for the service engineer to arrive from another part of the world to repair the machine. Using the concept of distance access, the service engineer needs only to be remotely connected to the down machine and MATLAB can once again be useful to analysis the symptoms and suggest possible causes, along with solutions. Of course the symptom has to be first modelled accurately just like the diode and other devices are modelled.

Here and in this distance based learning scenario, the basic experimentation set-up and discussed in section 5 (Case study 2: computer aided learning scenario) can be modified to be accessible via the Internet. Essentially, a web-server arrangement (a WAMP (Windows, Apache [12], MySQL [13] and PHP [14])) system is set-up here and the experiment user

interface is via a series of Internet browser pages (web pages). Figure 17 shows the home page set-up for the experiment.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 389

In order to run an experiment, the user chooses the diode in forward bias or reverse bias mode of operation via the top menu system. Figure 18 shows the forward bias experiment web page. This provides for an introduction to the experiment and an area to enter the values of the input voltage (*Vin*) to apply to the test circuit. This is via an HTML form seen to the right of the page. All values are entered into the form and then submitted to the web

server (and hence the experiment) using the *Submit* button.

**Figure 18.** Remote submission of diode forward bias experiment input voltage values

bias experiment is selected rather than the forward bias experiment.

the user to pre-book the experiment.

Figure 19 shows the reverse bias experiment web page. This page has the same form as the forward bias experiment, except now on submission of the input voltage values, the reverse

As the experiments are performed remotely with the experiment electronic hardware connected to the web server PC, the user has a much more restricted and controlled access to the experiment. In this arrangement, the experiment is run on the remote web server and the results are accessible via a web page. Here, the user does not have interactive control of the experiment, rather they submit their values and the web server treats this as a job to complete, allowing the same experiment to be used by multiple users without the need for


**Figure 17.** User interface (home page)

In the user interface, the user is considered to already have successfully logged in to the remote laboratory via a username/password arrangement and is then given access to a diode experiment menu system (top of the page) for accessing different parts of the experiment. These options are identified in table 4. The user is prompted to access the different web pages in order to access different aspects of the experiment, including access to MATLAB via the web server arrangement.


**Table 4.** User interface options

In order to run an experiment, the user chooses the diode in forward bias or reverse bias mode of operation via the top menu system. Figure 18 shows the forward bias experiment web page. This provides for an introduction to the experiment and an area to enter the values of the input voltage (*Vin*) to apply to the test circuit. This is via an HTML form seen to the right of the page. All values are entered into the form and then submitted to the web server (and hence the experiment) using the *Submit* button.

388 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

page set-up for the experiment.

**Figure 17.** User interface (home page)

**Table 4.** User interface options

to MATLAB via the web server arrangement.

interface is via a series of Internet browser pages (web pages). Figure 17 shows the home

In the user interface, the user is considered to already have successfully logged in to the remote laboratory via a username/password arrangement and is then given access to a diode experiment menu system (top of the page) for accessing different parts of the experiment. These options are identified in table 4. The user is prompted to access the different web pages in order to access different aspects of the experiment, including access

Option Option description

MATLAB analysis Create a MATLAB function to enter and analyse the experiment results. Results View the results from previously run experiments

Further reading List of references (which can be added to by users). User area Area to allow users to add notes for all users to access. Logout Log out from the overall remote laboratory arrangement.

and MATLAB analyses.

Forward bias Run the diode forward bias experiment. Reverse bias Run the diode reverse bias experiment.

Experiment home Return to this (home) page.

**Figure 18.** Remote submission of diode forward bias experiment input voltage values

Figure 19 shows the reverse bias experiment web page. This page has the same form as the forward bias experiment, except now on submission of the input voltage values, the reverse bias experiment is selected rather than the forward bias experiment.

As the experiments are performed remotely with the experiment electronic hardware connected to the web server PC, the user has a much more restricted and controlled access to the experiment. In this arrangement, the experiment is run on the remote web server and the results are accessible via a web page. Here, the user does not have interactive control of the experiment, rather they submit their values and the web server treats this as a job to complete, allowing the same experiment to be used by multiple users without the need for the user to pre-book the experiment.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 391

**Figure 20.** Viewing experiment results

**Figure 21.** Remote submission of MATLAB commands to web server for remote processing

**Figure 19.** Remote submission of diode reverse bias experiment input voltage values

Figure 20 shows the experiment results page that the user sees. Their submitted test values and the experiment results are available as hypertext links via this web page. Hence, the user can see the text based experiment results which would then be used in MATLAB to analyse the results.

The MATLAB analysis is undertaken by entering the code for a MATLAB *function* into a form on the web page and then submitting the *function* to the web server for remote processing. On completion of the processing, the results are available for the user to access.

In figure 21, a template form for the MATLAB code as a function is automatically presented to the student and they complete the function with their own comments. This is shown in more detail in figure 22 and listing 5. The user does not modify this code structure, but inserts their own code between the "% Start of user commands" and "% End of user commands" comments.

On submission of the completed form, the code is automatically saved in a function m-file, MATLAB automatically executes the m-file commands and the results are saved to suitable results files.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 391


**Figure 20.** Viewing experiment results

390 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 19.** Remote submission of diode reverse bias experiment input voltage values

analyse the results.

commands" comments.

results files.

access.

Figure 20 shows the experiment results page that the user sees. Their submitted test values and the experiment results are available as hypertext links via this web page. Hence, the user can see the text based experiment results which would then be used in MATLAB to

The MATLAB analysis is undertaken by entering the code for a MATLAB *function* into a form on the web page and then submitting the *function* to the web server for remote processing. On completion of the processing, the results are available for the user to

In figure 21, a template form for the MATLAB code as a function is automatically presented to the student and they complete the function with their own comments. This is shown in more detail in figure 22 and listing 5. The user does not modify this code structure, but inserts their own code between the "% Start of user commands" and "% End of user

On submission of the completed form, the code is automatically saved in a function m-file, MATLAB automatically executes the m-file commands and the results are saved to suitable


**Figure 21.** Remote submission of MATLAB commands to web server for remote processing


Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 393

Create figure

Plot to figure Add grid Add title

Add x-axis label Add y-axis label

Close figure

Print figure to JPG file

1. MATLAB is run remotely on a different computer and so any instant visual feedback that a user would see when running MATLAB on his or her own computer is not

2. If any errors are encountered in the user provided code, MATLAB must exit "gracefully" and not simply crash. It must also be able to provide suitable error

To this extent, the above function template captures and reports errors, and the text feedback that would normally be seen in the MATLAB Command Window is automatically

A third aspect of using MATLAB in this manner is that any figures to plot the results would

To this extent, whenever a figure plot is to be produced, this will need to be saved as an image file (using the commands of the form shown in listing 6) and if the image file is in JPEG format, it will be displayed in the Results page along with the MATLAB log file and

Here in listing 6, a figure is created and plotted to (along with the annotation required by the user). Here, a figure called *figH* is created and plots the variables **Vd\_forward** and **Id\_forward** along with a figure title and axis labels. This is then saved to an image file in

Once an analysis has been undertaken, the results are available for viewing on the results page in the format as shown in figure 23. Here, the analysis run name (a unique run name), the image files produced, the generated MATLAB m-file and the MATLAB log file are

outputted to a text log file (and this file is available via the Results Page).

not be seen if simply the plot(x, y) command was used.

figH = figure('visible', 'off')

xlabel('Vin (volts)') ylabel('I (amps)')

**Listing 6.** MATLAB: plotting the figure to a JPEG image file

JPEG format with the file name Figure1.jpg.

plot(Vd\_forward, Id\_forward)

title('Vin Vs I (Forward biased diode)')

print(figH, '-djpeg', 'Figure1.jpg')

Two important aspects of using MATLAB in this manner are:

immediately available.

feedback to the user.

the uploaded analysis code.

grid

close(figH)

available for viewing.

**Figure 22.** Remote submission of MATLAB commands to web server for remote processing

The function template code is shown in listing 5. On submission, this function is saved into the m-file and MATLAB is executed on the web server PC. In order to handle possible errors in the submitted code, then the *try – catch* error control is used.

```
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
      function Remote_Run() 
      try 
      %------------------------------------ 
      % Start of user commands 
      %------------------------------------ 
      %------------------------------------ 
      % End of user commands 
      %------------------------------------ 
       exit 
      catch 
       exit 
      end
```
**Listing 5.** MATLAB function template

Two important aspects of using MATLAB in this manner are:

392 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 22.** Remote submission of MATLAB commands to web server for remote processing

in the submitted code, then the *try – catch* error control is used.

%------------------------------------

%------------------------------------

%------------------------------------

%------------------------------------

function Remote\_Run()

% Start of user commands

% End of user commands

exit

exit

**Listing 5.** MATLAB function template

catch

end

try

The function template code is shown in listing 5. On submission, this function is saved into the m-file and MATLAB is executed on the web server PC. In order to handle possible errors


To this extent, the above function template captures and reports errors, and the text feedback that would normally be seen in the MATLAB Command Window is automatically outputted to a text log file (and this file is available via the Results Page).

A third aspect of using MATLAB in this manner is that any figures to plot the results would not be seen if simply the plot(x, y) command was used.

To this extent, whenever a figure plot is to be produced, this will need to be saved as an image file (using the commands of the form shown in listing 6) and if the image file is in JPEG format, it will be displayed in the Results page along with the MATLAB log file and the uploaded analysis code.

```
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
     figH = figure('visible', 'off') 
           plot(Vd_forward, Id_forward) 
           grid 
           title('Vin Vs I (Forward biased diode)') 
           xlabel('Vin (volts)') 
           ylabel('I (amps)') 
           print(figH, '-djpeg', 'Figure1.jpg') 
     close(figH) 
                                                        Create figure 
                                                        Plot to figure 
                                                        Add grid 
                                                        Add title 
                                                        Add x-axis label 
                                                        Add y-axis label 
                                                        Print figure to JPG file 
                                                        Close figure
```
**Listing 6.** MATLAB: plotting the figure to a JPEG image file

Here in listing 6, a figure is created and plotted to (along with the annotation required by the user). Here, a figure called *figH* is created and plots the variables **Vd\_forward** and **Id\_forward** along with a figure title and axis labels. This is then saved to an image file in JPEG format with the file name Figure1.jpg.

Once an analysis has been undertaken, the results are available for viewing on the results page in the format as shown in figure 23. Here, the analysis run name (a unique run name), the image files produced, the generated MATLAB m-file and the MATLAB log file are available for viewing.

Using MATLAB in the Teaching and Learning of Semiconductor Device Fundamentals 395

this work, consideration was given to the use of MATLAB in three teaching and learning scenarios; (i) at-presence "traditional" laboratory experiments; (ii) at-presence computer aided learning laboratories; and (iii), distance based remote access to laboratory experiments. Each scenario was introduced and the development of the laboratory experiments discussed. The physical infrastructure (electronic hardware and software) was identified and the role in which technology is utilised in the education environment was presented. In particular, the way in which MATLAB was considered to be used and how it was integrated into custom developed education technology tools were highlighted. The discussions were based on the evaluation of the Schottky barrier diode, specifically the BAT86 Schottky barrier diode. However, the discussions, arguments and experimentation hardware and software can be readily adapted to other forms of semiconductor devices.

*Department of Electronic and Computer Engineering, University of Limerick, Limerick, Ireland* 

*Faculty of Electrical Engineering, Universiti Teknologi Malaysia (UTM), Skudai, Johor, Malaysia* 

[3] Duane Hanselman and Bruce R. Littlefield, Mastering MATLAB 6, 6th Ed., Prentice

[4] Pierret R.F., Semiconductor Device Fundamentals, 1996, Addison-Wesley Publishing

[5] Sze S.M., Semiconductor Devices Physics and Technology, 1985, John Wiley & Sons.

[8] Microsoft Corporation, 2012, Visual Basic 6.0, msdn.microsoft.com/en-us/vstudio/

[10] Ian Andrew Grout and Alexandre César Rodrigues da Silva, "Analysis Tool for Remote Laboratory Structures", Proceedings of the Remote Experimentation and Virtual Instrumentation conference (REV 2010), Stockholm, June 29 - July 2, 2010, www.rev-

[11] R. Ratering et al., "GridBeans: Supporting e-Science and Grid Applications", Proceedings of the 2nd IEEE International Conference on e-Science and Grid

[1] The Mathworks Inc., MATLAB®, 2012, www.themathworks.com [2] NXP, BAT86 Schottky barrier diode product datasheet, 2004, www.nxp.com/documents/data\_sheet/BAT86.pdf

www.xilinx.com/support/documentation/data\_sheets/ds099.pdf

Computing", 4-6 Dec. 2006, Amsterdam, The Netherlands

[7] Altium, TR0104 LiveDesign Evaluation Board Technical Reference Manual, 2004

Hall; 1 edition (14 Dec 2000), ISBN 0130194689

[6] Xilinx Inc., Spartan-3 FPGA Family Data Sheet, 2009,

Company, ISBN 0-13-178459-5x

Inc., ISBN 0-471-83704-0

[9] Moodle, 2012, moodle.org/

conference.org/REV2010/

**Author details** 

Abu Khari Bin A'ain

**8. References** 

ms788229

Ian Grout

**Figure 23.** MATLAB analysis results access

The user can click on the computer mouse on the image and this shows the full-size figure in a new browser window. Where the user runs an m-file to create multiple figures and save these as image files, each generated image file is shown in the results window and is therefore accessible. The image file can then be saved to the student's own computer for later inclusion in experiment reports.

In this work, the infrastructure to support the use of MATLAB to be accessed via an Internet browser page is developed and discussed.

A final comment to make however relates to the use of the MATLAB software license where MATLAB runs on a particular computer, but is accessed remotely from a separate computer. It is not the intention to discuss specifics about the use of the software license and if there is any doubt about the use of the license in this mode then the provider of the license should be consulted.

## **7. Conclusions**

This chapter has presented and discussed the use of MATLAB within an education environment with reference to the teaching and learning of semiconductor device fundamentals. Specifically, MATLAB can be integrated into the education curriculum as a tool to provide specific analysis and results presentation operations, these being (i) physical electronic circuit test results data entry, analysis and graphical plotting; (ii) idealised device characteristic equation modelling and graphical plotting; (iii) comparisons between idealised and actual device performance; and (iv) documentation preparation purposes. In this work, consideration was given to the use of MATLAB in three teaching and learning scenarios; (i) at-presence "traditional" laboratory experiments; (ii) at-presence computer aided learning laboratories; and (iii), distance based remote access to laboratory experiments. Each scenario was introduced and the development of the laboratory experiments discussed. The physical infrastructure (electronic hardware and software) was identified and the role in which technology is utilised in the education environment was presented. In particular, the way in which MATLAB was considered to be used and how it was integrated into custom developed education technology tools were highlighted. The discussions were based on the evaluation of the Schottky barrier diode, specifically the BAT86 Schottky barrier diode. However, the discussions, arguments and experimentation hardware and software can be readily adapted to other forms of semiconductor devices.

## **Author details**

394 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

The user can click on the computer mouse on the image and this shows the full-size figure in a new browser window. Where the user runs an m-file to create multiple figures and save these as image files, each generated image file is shown in the results window and is therefore accessible. The image file can then be saved to the student's own computer for

In this work, the infrastructure to support the use of MATLAB to be accessed via an

A final comment to make however relates to the use of the MATLAB software license where MATLAB runs on a particular computer, but is accessed remotely from a separate computer. It is not the intention to discuss specifics about the use of the software license and if there is any doubt about the use of the license in this mode then the provider of the

This chapter has presented and discussed the use of MATLAB within an education environment with reference to the teaching and learning of semiconductor device fundamentals. Specifically, MATLAB can be integrated into the education curriculum as a tool to provide specific analysis and results presentation operations, these being (i) physical electronic circuit test results data entry, analysis and graphical plotting; (ii) idealised device characteristic equation modelling and graphical plotting; (iii) comparisons between idealised and actual device performance; and (iv) documentation preparation purposes. In

**Figure 23.** MATLAB analysis results access

later inclusion in experiment reports.

license should be consulted.

**7. Conclusions** 

Internet browser page is developed and discussed.

Ian Grout *Department of Electronic and Computer Engineering, University of Limerick, Limerick, Ireland* 

Abu Khari Bin A'ain *Faculty of Electrical Engineering, Universiti Teknologi Malaysia (UTM), Skudai, Johor, Malaysia* 

## **8. References**

	- [12] The Apache Software Foundation, Apache HTTP Server Project, 2012, httpd.apache.org/

**Chapter 16** 

© 2012 Aliane et al., licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

© 2012 Aliane et al., licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

**An Interactive Tool for Servo Systems Learning** 

Servo systems play an important role in industry. They are found in most automated manufacturing systems, machine tools, and robotic systems to cite but a few examples. Servo systems fundamentals have become an integral part of industrial electronics and other related fields in engineering, such as electrical engineering or computer disciplines. Servo systems topics should be extended to all engineering curricula [1]. It is therefore a major challenge to ensure that future engineers should be familiar with servo systems, and be able

A direct current controlled motor (DC motor) is considered to be the simplest form of servo system, and is used as a starting point for understanding all other electric machines. Control of DC motors is widely taught in control engineering and robotics courses, and is commonly used in laboratory experiments as providing an excellent case study. The importance of the material is well-evidenced in many textbooks [2]-[5]. However, in most of these texts, servo system problems are highly simplified for pedagogical purposes, and the given examples focus on the linear parts, and do not take into account practical issues such as compliance coupling, trajectory generation, the wind-up effect, feed-forward compensation, or torque

This paper presents an interactive learning module focused exclusively on servo systems. It is aimed at bridging the gap between theoretical background and experimentation, providing insight into fundamental concepts. The tool is based on exploiting interactivity as a pedagogical basis in teaching and learning activities. Although many interactive tools have been developed for general topics in control education [6]-[9], interactive tools

There are several works in the literature which deal with the use of Matlab-Simulink for servo systems simulations for educational purposes [10]-[13], but the tools presented in these works lack interactivity. The Matlab Central File Exchange [14] is also used as a source

Nourdine Aliane, Rafael Pastor Vargas and Javier Fernández Andrés

Additional information is available at the end of the chapter

focusing on servo systems are practically nonexistent.

http://dx.doi.org/10.5772/46459

to analyze and control them.

**1. Introduction** 

limitation.


## **An Interactive Tool for Servo Systems Learning**

Nourdine Aliane, Rafael Pastor Vargas and Javier Fernández Andrés

Additional information is available at the end of the chapter

http://dx.doi.org/10.5772/46459

## **1. Introduction**

396 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

[14] PHP, PHP Hypertext Preprocessor, 2012, www.php.net/

[13] MySQL, 2012, dev.mysql.com/

[12] The Apache Software Foundation, Apache HTTP Server Project, 2012, httpd.apache.org/

Servo systems play an important role in industry. They are found in most automated manufacturing systems, machine tools, and robotic systems to cite but a few examples. Servo systems fundamentals have become an integral part of industrial electronics and other related fields in engineering, such as electrical engineering or computer disciplines. Servo systems topics should be extended to all engineering curricula [1]. It is therefore a major challenge to ensure that future engineers should be familiar with servo systems, and be able to analyze and control them.

A direct current controlled motor (DC motor) is considered to be the simplest form of servo system, and is used as a starting point for understanding all other electric machines. Control of DC motors is widely taught in control engineering and robotics courses, and is commonly used in laboratory experiments as providing an excellent case study. The importance of the material is well-evidenced in many textbooks [2]-[5]. However, in most of these texts, servo system problems are highly simplified for pedagogical purposes, and the given examples focus on the linear parts, and do not take into account practical issues such as compliance coupling, trajectory generation, the wind-up effect, feed-forward compensation, or torque limitation.

This paper presents an interactive learning module focused exclusively on servo systems. It is aimed at bridging the gap between theoretical background and experimentation, providing insight into fundamental concepts. The tool is based on exploiting interactivity as a pedagogical basis in teaching and learning activities. Although many interactive tools have been developed for general topics in control education [6]-[9], interactive tools focusing on servo systems are practically nonexistent.

There are several works in the literature which deal with the use of Matlab-Simulink for servo systems simulations for educational purposes [10]-[13], but the tools presented in these works lack interactivity. The Matlab Central File Exchange [14] is also used as a source

to search for servo systems educational tools. Several excellent demonstrations can be found, but none of them meet the criteria for simulating practical aspects of servo systems. It is also worth mentioning the use of remote laboratories, where DC motors are successfully integrated in remote experimentation platforms [15]-[16]. However, remote experimentation is currently limited to performing simple experiments, and topics such as the effects of disturbances, anti-windup, or feed-forward, are not considered.

An Interactive Tool for Servo Systems Learning 399

The developed tool simulates the behavior of a separately-excited DC motor, and covers several practical issues of servo systems. Students can, among other capabilities, configure the model, perform simulations of position and speed control, interactively tune the controller, specify trajectories, and compare different control algorithms. Lastly, the user can

Servo systems topics, as treated in many textbooks, consider simple models and assume that the motor shaft and its load are rigidly coupled. In practice, however, most servomechanisms contain flexible modes in the actuator or the structure being controlled. This is particularly true in systems such as disk drives, antennae and radar pointing or robotics axes, where coupling might have significant compliance. For a model to be useful, it must be realistic and yet simple enough to understand and manipulate. In general, flexible coupling is modeled as a rotational spring, which is sufficient to yield models of

The interactive tool presented in this paper simulates a DC motor coupled to its load through a shaft with variable compliance (see Figure. 1). The user can set the model to what

, *m m J b <sup>L</sup> J*

*k b* ,

In the case of an armature-controlled DC motor, the control input is the armature voltage *U.*  The torque *T* provided by the motor is proportional to the armature current *i*, and the back

> *m m*

*T ki e k* 

*di U e L Ri*

emf *e* is proportional to the motor's velocity *ω,* by the following equations

where *R* is the armature resistance and *L* is the armature winding inductance.

*L*

(1)

*dt* (2)

s/he considers relevant (a compliantly or rigidly coupled model).

*m*

**Figure 1.** Model of motor and load compliantly coupled.

The electrical equation is

perform comparisons of simulations by evaluating some performance measures.

**3. Servo system background** 

**3.1. Servo system modelling** 

high order.

The development of the module presented in this paper is based on Simulink models used in combination with the Matlab graphical user interface (GUI). The choice of the Matlab platform is due to the fact that it is by far more productive than many other high level programming languages. Simulink, on the other hand, is used to easily model and simulate a variety of systems using intuitive block diagrams. Wrapping Simulink models within Matlab-GUI is advantageous and improves interactivity. This feature allows users to change parameters and view simulations without having to deal directly with Simulink blocks. Indeed, Matlab includes a built-in tool called GUIDE, which permits developers to design GUIs for Matlab applications.

The remainder of the paper is organized as follows: Section 2 presents the objectives and scope of the tool. Section 3 gives some theoretical background on servo systems. Section 4 describes the interactive module and shows how Simulink models can be integrated within an interactive Matalb-GUI. Section 5 describes usage experiences and gives some classroom examples. Section 6 describes the methodology used in evaluation and discusses the results obtained. Finally, Section 7 concludes the paper.

## **2. Objectives and scope**

In the author's institution, servo systems topics are an integral part of undergraduate control engineering and robotics courses. This part of the material examines servo systems principles, providing students with modeling techniques for DC motors, the formulation of the control problem, and an introduction to the basic treatment of feedback design. The theoretical background is supplemented with hands-on laboratory work. The laboratory activities are aimed at showing the students some qualitative aspects of servo systems control and giving them a broad picture of axis control. However, there is neither enough time nor sufficient equipment to experiment with all the practical aspects of servo systems.

To remedy this situation, the methodology was recently modified to place greater emphasis on fundamental concepts, because the tuning of servo systems can be confusing due rather to unfamiliar principles than to their complexity. Thus, to help students develop their knowledge of, and intuition for, servo systems and their control, an interactive module, dedicated exclusively to this topic, was developed. The tool is aimed at speeding up learning by reducing the time needed to design simulations. It is also intended to be interactive in the sense that it allows students to see immediately the effects of changing parameters on the behavior of systems. Finally, the tool is intended to complement rather than replace laboratory work.

The developed tool simulates the behavior of a separately-excited DC motor, and covers several practical issues of servo systems. Students can, among other capabilities, configure the model, perform simulations of position and speed control, interactively tune the controller, specify trajectories, and compare different control algorithms. Lastly, the user can perform comparisons of simulations by evaluating some performance measures.

## **3. Servo system background**

#### **3.1. Servo system modelling**

398 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

disturbances, anti-windup, or feed-forward, are not considered.

GUIs for Matlab applications.

**2. Objectives and scope** 

than replace laboratory work.

obtained. Finally, Section 7 concludes the paper.

to search for servo systems educational tools. Several excellent demonstrations can be found, but none of them meet the criteria for simulating practical aspects of servo systems. It is also worth mentioning the use of remote laboratories, where DC motors are successfully integrated in remote experimentation platforms [15]-[16]. However, remote experimentation is currently limited to performing simple experiments, and topics such as the effects of

The development of the module presented in this paper is based on Simulink models used in combination with the Matlab graphical user interface (GUI). The choice of the Matlab platform is due to the fact that it is by far more productive than many other high level programming languages. Simulink, on the other hand, is used to easily model and simulate a variety of systems using intuitive block diagrams. Wrapping Simulink models within Matlab-GUI is advantageous and improves interactivity. This feature allows users to change parameters and view simulations without having to deal directly with Simulink blocks. Indeed, Matlab includes a built-in tool called GUIDE, which permits developers to design

The remainder of the paper is organized as follows: Section 2 presents the objectives and scope of the tool. Section 3 gives some theoretical background on servo systems. Section 4 describes the interactive module and shows how Simulink models can be integrated within an interactive Matalb-GUI. Section 5 describes usage experiences and gives some classroom examples. Section 6 describes the methodology used in evaluation and discusses the results

In the author's institution, servo systems topics are an integral part of undergraduate control engineering and robotics courses. This part of the material examines servo systems principles, providing students with modeling techniques for DC motors, the formulation of the control problem, and an introduction to the basic treatment of feedback design. The theoretical background is supplemented with hands-on laboratory work. The laboratory activities are aimed at showing the students some qualitative aspects of servo systems control and giving them a broad picture of axis control. However, there is neither enough time nor sufficient equipment to experiment with all the practical aspects of servo systems.

To remedy this situation, the methodology was recently modified to place greater emphasis on fundamental concepts, because the tuning of servo systems can be confusing due rather to unfamiliar principles than to their complexity. Thus, to help students develop their knowledge of, and intuition for, servo systems and their control, an interactive module, dedicated exclusively to this topic, was developed. The tool is aimed at speeding up learning by reducing the time needed to design simulations. It is also intended to be interactive in the sense that it allows students to see immediately the effects of changing parameters on the behavior of systems. Finally, the tool is intended to complement rather Servo systems topics, as treated in many textbooks, consider simple models and assume that the motor shaft and its load are rigidly coupled. In practice, however, most servomechanisms contain flexible modes in the actuator or the structure being controlled. This is particularly true in systems such as disk drives, antennae and radar pointing or robotics axes, where coupling might have significant compliance. For a model to be useful, it must be realistic and yet simple enough to understand and manipulate. In general, flexible coupling is modeled as a rotational spring, which is sufficient to yield models of high order.

The interactive tool presented in this paper simulates a DC motor coupled to its load through a shaft with variable compliance (see Figure. 1). The user can set the model to what s/he considers relevant (a compliantly or rigidly coupled model).

**Figure 1.** Model of motor and load compliantly coupled.

In the case of an armature-controlled DC motor, the control input is the armature voltage *U.*  The torque *T* provided by the motor is proportional to the armature current *i*, and the back emf *e* is proportional to the motor's velocity *ω,* by the following equations

$$\begin{aligned} T &= k\_m i \\ e &= k\_m \alpha \end{aligned} \tag{1}$$

The electrical equation is

$$
\Delta U - e = L\frac{di}{dt} + Ri\tag{2}
$$

where *R* is the armature resistance and *L* is the armature winding inductance.

The torque provided by the motor is transmitted to the load through the compliant shaft, which is modeled as a rotary spring with constant *k* and damping constant *b*. The mechanical equations of the motion are:

$$\begin{aligned} J\_m \ddot{\Theta}\_m + b\_m \dot{\Theta}\_m + b \left( \dot{\Theta}\_m - \dot{\Theta}\_L \right) + k \left( \Theta\_m - \Theta\_L \right) &= k\_m i \\ J\_L \ddot{\Theta}\_L - b \left( \dot{\Theta}\_m - \dot{\Theta}\_L \right) - k \left( \Theta\_m - \Theta\_L \right) &= 0 \end{aligned} \tag{3}$$

An Interactive Tool for Servo Systems Learning 401

The mathematical expression in the time domain is given by the equation (8).

solutions.

*3.2.1. Anti-windup correction* 

 () () ( ) () () () () *pi d d rt yt r t y t K r t y t dt K dt*

where u(t) is the controller output, r(t) is the reference, y(t) is the measured system output, and *Kp, Ki* and *Kp* are the PID adjustable parameters. In real servo systems, PID controllers can perform poorly when used alone. To enhance the system performance, a number of additional mechanisms such as handling the wind-up effect properly, combining the feedback with feed-forward control, or using a trajectory generator, are adopted as technical

The elimination of the steady state error in servo systems has long been performed using the integrator action. However, this action has the disadvantage of causing the wind-up effect, which occurs when the calculated control signal exceeds its saturation limits and the controller is unable to respond immediately to changes in the error signal. To prevent the windup effect, the operating range of the control signal should be limited to the range of the voltage input of the servo [22]. This ad-hoc solution provides instant recovery when the error signal changes signs. There are many way to ovoid the integrator wind-up and one of

Feed-forward is another technique used to improve servo systems performance and is essentially used to reduce the tracking error in high performance motion control problems. Theoretical developments show that the feed-forward transfer function is the inverse dynamic of the servo. In general, feed-forward compensation is performed through the

these possibilities is illustrated in the following Simulink diagram.

**Figure 2.** PID controller with Anti-Windup correction.

*3.2.2. Feed-forward control* 

required acceleration and velocity.

*ut K* (8)

where subscript *m* refers to the motor, subscript *L* refers to the load, *J* is an inertia, and *b* is a damping constant.

Defining the sate vector as , , ,, , *<sup>T</sup> mmLL x i* the state space representation of the DC motor with compliant coupling

$$\dot{\mathbf{x}} = \begin{bmatrix} -\mathbf{R}/L & \mathbf{0} & -\mathbf{k}'\_{m}/L & \mathbf{0} & \mathbf{0} \\ \mathbf{0} & \mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0} \\ \mathbf{k}\_{m}/f\_{m} & -\mathbf{k}/f\_{m} & -(\mathbf{b}+\mathbf{b}\_{m})/f\_{m} & \mathbf{k}\_{m}/f\_{m} & \mathbf{b}/f\_{m} \\ \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{0} & \mathbf{1} \\ \mathbf{0} & \mathbf{k}/f\_{L} & \mathbf{b}/f\_{L} & -\mathbf{k}/f\_{L} & -\mathbf{b}/f\_{L} \end{bmatrix} \mathbf{x} + \begin{bmatrix} 1/L \\ 0 \\ 0 \\ 0 \\ 0 \end{bmatrix} \mu \tag{4}$$

If the coupling shaft is rigid, then *k <sup>→</sup> <sup>∞</sup>*, and *<sup>m</sup> <sup>L</sup>* . Adding the two mechanical subsystem equations (3) yields

$$J\_{m}\ddot{\Theta}\_{m} + J\_{L}\ddot{\Theta}\_{L} + b\_{m}\dot{\Theta}\_{m} = k\_{m}i\tag{5}$$

Thus, the mechanical subsystem becomes

$$(J\_{m} + J\_{L})\ddot{\Theta}\_{m} + b\_{m}\dot{\Theta}\_{m} = k\_{m}\dot{i} \tag{6}$$

Defining the total moment of inertia as *JJ J <sup>m</sup> <sup>L</sup>* , and the state as , , *<sup>T</sup> m m x i* , the state space equation is now simplified as

$$
\dot{\mathbf{x}} = \begin{bmatrix} -R/L & 0 & -k\_m'/L \\ 0 & 0 & 1 \\ k\_m/f & 0 & -b\_m/f \end{bmatrix} \mathbf{x} + \begin{bmatrix} 1/L \\ 0 \\ 0 \end{bmatrix} \boldsymbol{\mu} \tag{7}
$$

#### **3.2. Servo system control**

Despite the development of more advanced control techniques, the PID controller is still the most common algorithm used in servo systems applications [17]. The attractiveness of PID resides in the fact that an accurate model is not required and its control capabilities have been proven to be adequate for controlling servo systems. Indeed, PID controllers are used in many dedicated motion-control, such as LM628/629 [18], Magellan [19], Galil boards [20], or the Quanser DC motor model for training and education [21].

The mathematical expression in the time domain is given by the equation (8).

$$u(t) = K\_p \left( r(t) - y(t) \right) + K\_i \left[ \left( r(t) - y(t) \right) dt + K\_d \frac{d \left( r(t) - y(t) \right)}{dt} \right] \tag{8}$$

where u(t) is the controller output, r(t) is the reference, y(t) is the measured system output, and *Kp, Ki* and *Kp* are the PID adjustable parameters. In real servo systems, PID controllers can perform poorly when used alone. To enhance the system performance, a number of additional mechanisms such as handling the wind-up effect properly, combining the feedback with feed-forward control, or using a trajectory generator, are adopted as technical solutions.

#### *3.2.1. Anti-windup correction*

400 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

*LL L L m m*

*Jb k*

*R L k L*

mechanical equations of the motion are:

Defining the sate vector as , , ,, , *<sup>T</sup>*

damping constant.

motor with compliant coupling

subsystem equations (3) yields

Thus, the mechanical subsystem becomes

state space equation is now simplified as

**3.2. Servo system control** 

The torque provided by the motor is transmitted to the load through the compliant shaft, which is modeled as a rotary spring with constant *k* and damping constant *b*. The

> 0 *J b b k ki mm mm m m m L L*

where subscript *m* refers to the motor, subscript *L* refers to the load, *J* is an inertia, and *b* is a

<sup>0</sup> 0 0 <sup>1</sup>

( ) 0

(4)

*m L*

00 1 00 0

00 0 01 0 0 0

*kJ bJ kJ bJ L L LL*

*<sup>x</sup> k J kJ b b J k J bJ x u mm m m m mm m*

If the coupling shaft is rigid, then *k <sup>→</sup> <sup>∞</sup>*, and *<sup>m</sup> <sup>L</sup>* . Adding the two mechanical

*<sup>J</sup> <sup>L</sup> J b ki m m mm m*

0 1 00 1 0 0 0

*m*

Despite the development of more advanced control techniques, the PID controller is still the most common algorithm used in servo systems applications [17]. The attractiveness of PID resides in the fact that an accurate model is not required and its control capabilities have been proven to be adequate for controlling servo systems. Indeed, PID controllers are used in many dedicated motion-control, such as LM628/629 [18], Magellan [19], Galil boards [20],

*RL k L L x x u*

Defining the total moment of inertia as *JJ J <sup>m</sup> <sup>L</sup>* , and the state as , , *<sup>T</sup>*

*m m*

or the Quanser DC motor model for training and education [21].

*kJ bJ*

(3)

*mmLL x i* the state space representation of the DC

*J J b ki mm mm m L L* (5)

(7)

(6)

*m m x i* , the

The elimination of the steady state error in servo systems has long been performed using the integrator action. However, this action has the disadvantage of causing the wind-up effect, which occurs when the calculated control signal exceeds its saturation limits and the controller is unable to respond immediately to changes in the error signal. To prevent the windup effect, the operating range of the control signal should be limited to the range of the voltage input of the servo [22]. This ad-hoc solution provides instant recovery when the error signal changes signs. There are many way to ovoid the integrator wind-up and one of these possibilities is illustrated in the following Simulink diagram.

**Figure 2.** PID controller with Anti-Windup correction.

#### *3.2.2. Feed-forward control*

Feed-forward is another technique used to improve servo systems performance and is essentially used to reduce the tracking error in high performance motion control problems. Theoretical developments show that the feed-forward transfer function is the inverse dynamic of the servo. In general, feed-forward compensation is performed through the required acceleration and velocity.

An Interactive Tool for Servo Systems Learning 403

on the World Wide Web [23]. The layout of the GUI of the interactive module is shown in

**Figure 5.** The servo systems learning module main user interface.

for capturing model parameters.

Its interface visually displays all the actions that users may execute. In the first group of controls, users can select between a rigid or flexible coupling model. The difference between these models can be visualized by their open-loop step response. Furthermore, the compliance of the flexible coupling can be changed interactively which allows students visualize the significance of coupling stiffness better. Users can also customize the model by setting the model parameters in the "model parameters" button, which displays a window

Figure 5.

**Figure 3.** PID controller with feed-forward control.

### *3.2.3. Motion control*

In real servo systems control, the position step references can cause controller saturation and lead to significant overshoot, and indeed, this kind of references are hardly used. The step response is actually used as a measure of system performance. To overcome these problems, references known as S-curves, such as parabolic or trapezoidal profiles, are used instead. These S-curves are provided by a trajectory generator, which is an algorithm at the top of control hierarchy.

**Figure 4.** Parabolic and trapezoidal profiles for motion control.

### **4. Interactive tool description**

As mentioned above, the interactive tool is composed of two parts: a Matlab-GUI application and a Simulink model. The Simulink model is completely transparent for end users, and is automatically opened and runs in the background. The tool is freely available on the World Wide Web [23]. The layout of the GUI of the interactive module is shown in Figure 5.

402 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

In real servo systems control, the position step references can cause controller saturation and lead to significant overshoot, and indeed, this kind of references are hardly used. The step response is actually used as a measure of system performance. To overcome these problems, references known as S-curves, such as parabolic or trapezoidal profiles, are used instead. These S-curves are provided by a trajectory generator, which is an algorithm at the top of

> Position Velocity Acceleration

As mentioned above, the interactive tool is composed of two parts: a Matlab-GUI application and a Simulink model. The Simulink model is completely transparent for end users, and is automatically opened and runs in the background. The tool is freely available


<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -0.6

Position Velocity Acceleration

**Figure 3.** PID controller with feed-forward control.

**Figure 4.** Parabolic and trapezoidal profiles for motion control.

<sup>0</sup> 0.5 <sup>1</sup> 1.5 <sup>2</sup> 2.5 <sup>3</sup> 3.5 <sup>4</sup> 4.5 <sup>5</sup> -0.6

**4. Interactive tool description** 

*3.2.3. Motion control* 

control hierarchy.


**Figure 5.** The servo systems learning module main user interface.

Its interface visually displays all the actions that users may execute. In the first group of controls, users can select between a rigid or flexible coupling model. The difference between these models can be visualized by their open-loop step response. Furthermore, the compliance of the flexible coupling can be changed interactively which allows students visualize the significance of coupling stiffness better. Users can also customize the model by setting the model parameters in the "model parameters" button, which displays a window for capturing model parameters.


An Interactive Tool for Servo Systems Learning 405

Output To Workspace3

> 1 Control

x' = Ax+Bu y = Cx+Du Saturation State-Space


Random Number

mechanisms are also valid for specifying other Simulink parameters such as sample time or time simulation through the GUI. Lastly, a Simulink simulation can be run by using the

As far as the trajectory generator is concerned, this is implemented as an "embedded Matlab function block," which is a Simulink block that contains a compiled Matlab code. Unlike "Matlab function blocks," which accept multiple inputs and support only a single scalar output, the functions in "embedded Matlab function blocks" allow multiple inputs and

ref\_p\_v\_a

To Workspace1 control\_signal

Step\_dist


Saturation Multiport

Switch

Multiport Switch1

To Workspace

**Figure 7.** a) Simulink block diagrams: General structure for servo systems simulation; b) The controller

1 s Integrator

(b)

1/Tr

Tr

(a)

1 open\_loop

PID\_Anti\_Windup

1 s Integrator1

Control


aa v v Ref erence output

open\_closed\_loop Vmax

v v

generator

Trajectory Generator

pp

aa

subsystem: the PID, anti-windup, and feed-forward control.

Kp Kp

Kd Kd

> Ki Ki

du/dt Derivative

> -K-Feed\_forward

Kvv Kvv

Kaa Kaa

"sim()" function.

return multiple outputs.

V\_max <sup>t</sup>

Tmax T\_max

Profile Profile

4 output

3 Reference

> 2 vv

1 aa


Amax A\_max Tmax Vmax Amax Pos Selector

Clock

**Figure 6.** DC-Motor model parameters.

This is suitable for motor modeling, and it is particularly useful for investigating the effects of some DC-motor's parameters on the speed and how the induced current is modified.

In the second group, users can select between simulating a velocity or position control. In the position besides the step input reference, users can choose parabolic or trapezoidal profiles as a trajectory reference. The third group deals with control, where users can interactively modify the PID tuning parameters and immediately see their effect on the system behavior. In addition, the feedback control can be augmented with a feed-forward and an anti-windup correction. The fourth group allows the simulation of the effect of exogenous factors such as external disturbances and noise measurements. The fifth group lets users save and retrieve simulations, which is particularly useful for drawing straightforward comparisons between different scenarios. Finally, as well as visualizing velocity, position, induced current, and voltage input, some performance measures, such as the integral of squared error (ISE) and the overshoot, are also displayed.

The design of the Matlab-GUI is easy using the Matlab GUIDE. This toolkit is opened by entering the command ">>guide" in the command line. Then, images of all the elements (sliders, axes plotting, etc) are dragged out, and then the user writes their respective callback functions. The reader can go further with the help of the Matlab GUI manuals.

The Simulink block diagram implementing the whole servo systems simulation is shown in Figure 7. Interfacing Simulink models with Matlab GUI applications is easy, but not trivial operation. The control of Simulink models can be performed through suitable Matlab commands. Simulink blocks can be accessed and their parameters changed by using the "set\_param()" function. Alternatively, the communication between Simulink models and Matlab-GUI can be performed by using variables defined in the main workspace. These two mechanisms are also valid for specifying other Simulink parameters such as sample time or time simulation through the GUI. Lastly, a Simulink simulation can be run by using the "sim()" function.

404 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

This is suitable for motor modeling, and it is particularly useful for investigating the effects of some DC-motor's parameters on the speed and how the induced current is modified.

R: Electric resistance L: Electric inductance

Bm: Damping ratio factor

Km: Electromotive force constant. Jm: Moment of inertia of the rotor

JL: Moment of inertia of the load U\_limit: Maximal input source voltage Amax: Maximal motor acceleration

In the second group, users can select between simulating a velocity or position control. In the position besides the step input reference, users can choose parabolic or trapezoidal profiles as a trajectory reference. The third group deals with control, where users can interactively modify the PID tuning parameters and immediately see their effect on the system behavior. In addition, the feedback control can be augmented with a feed-forward and an anti-windup correction. The fourth group allows the simulation of the effect of exogenous factors such as external disturbances and noise measurements. The fifth group lets users save and retrieve simulations, which is particularly useful for drawing straightforward comparisons between different scenarios. Finally, as well as visualizing velocity, position, induced current, and voltage input, some performance measures, such as

The design of the Matlab-GUI is easy using the Matlab GUIDE. This toolkit is opened by entering the command ">>guide" in the command line. Then, images of all the elements (sliders, axes plotting, etc) are dragged out, and then the user writes their respective callback

The Simulink block diagram implementing the whole servo systems simulation is shown in Figure 7. Interfacing Simulink models with Matlab GUI applications is easy, but not trivial operation. The control of Simulink models can be performed through suitable Matlab commands. Simulink blocks can be accessed and their parameters changed by using the "set\_param()" function. Alternatively, the communication between Simulink models and Matlab-GUI can be performed by using variables defined in the main workspace. These two

the integral of squared error (ISE) and the overshoot, are also displayed.

functions. The reader can go further with the help of the Matlab GUI manuals.

**Figure 6.** DC-Motor model parameters.

As far as the trajectory generator is concerned, this is implemented as an "embedded Matlab function block," which is a Simulink block that contains a compiled Matlab code. Unlike "Matlab function blocks," which accept multiple inputs and support only a single scalar output, the functions in "embedded Matlab function blocks" allow multiple inputs and return multiple outputs.

**Figure 7.** a) Simulink block diagrams: General structure for servo systems simulation; b) The controller subsystem: the PID, anti-windup, and feed-forward control.

Kvv Kvv

Reference

2 vv

1 aa Kaa Kaa Kp

Ki Ki

> -K-Feed\_forward

(b)

1 s Integrator

1/Tr

Saturation Multiport

Switch

Tr

## **5. Classroom experience**

The tool was used during the 2006-07 and 2007-08 academic years at Universidad Europea de Madrid (Spain), in control engineering and robotics subjects, providing the instructor with a valuable supplement to lectures by projecting the module screenshots. The first advantage of the tool presented here is that it allows the instructor to set up simulations with minimum effort, which obviously helps him to maintain the flow of the lecture, and allows him to pose different cases quickly in response to the students' questions. The module proved to be an effective instrument to facilitate teaching, since the interactive nature of the module helps to draw comparisons between simulations, explore the effect of varying parameters, and give explanations through "what-if" scenarios.

An Interactive Tool for Servo Systems Learning 407

**Example-1: Modeling and open-loop simulation** 

and flexible coupling are shown in Figure. 8.

**Figure 8.** Step responses of a DC motor with rigid and flexible coupling (k = 0.7).

The tool is used to study velocity control and its characteristics. For example, one exercise is devoted to simulating PI control, applying poles placement strategy. The tuning parameters are adjusted analytically assuming a simplified model. Afterwards, students are required to compare simulation outputs applying the same controller tuning to the model with flexible coupling. In the context of speed control, another exercise is dedicated to demonstrating the benefits of anti-windup correction. In this section, students are required to compare the system's output under different conditions: namely, a simulation with no saturation limits, a simulation with saturation limits, and a simulation with anti-windup compensation. This

0 1 2 3 4 5

Rigid coupling

Flexible coupling: motor speed Flexible coupling: load speed

Time

**Example-2: Speed control and anti-windup correction** 

comparison is illustrated in Figure. 9.

0

0.1

0.2

0.3

speed (rad/sec

0.4

0.5

0.6

0.7

Models are an essential element of servo system analysis and design, and serve to understand how systems behave with and without control. This aspect is covered through demonstrations shown during a lecture, carrying out comparisons of a motor's open-loop responses with rigid and flexible coupling, as well as observing dynamically how changes in the compliance parameter affects the shapes of the responses. Furthermore, different parameters of the model are taken into account and are changed dynamically in order to assess their effect in light of the modeling concept. Step responses of a DC motor with rigid

Speed

The learning module was also used by approximately 35 students in the classroom, following guided exercises. These exercises were focused on students getting a feel for the qualitative aspects of servo systems, having them explore what would happen if a given parameter were increased or decreased. The quantitative aspects were not emphasized as much. For example, students are asked to undertake the problem of position control and tracking trajectories. After a review of the PID controller, students are asked to tune the controller through a trial and error process, taking advantage of the interactivity of the tool. As a first step, students use proportional action (P) and examine steady-state error. Next, they introduce the integral action (I) to see how the steady-state error is eliminated. Finally, the derivative action (D) is activated to increase the dumping of the system. Robustness is also an important aspect in servo systems. In another exercise, simulations are performed to assess control strategy with respect to external disturbances, considering cases where a motor is holding a final position and a disturbance is applied to its shaft. Thanks to the module's interactivity, many other concepts such as flexible coupling, anti-windup and feed-forward corrections, or the use of S-curve references are presented with animated graphs examining the effects of some parameters. These exercises are solved in group, and the use of the interactive tool provides an excellent context for provoking discussions and reflections.

To foster interest in the use of the tool, a comprehensive tutorial, providing a number of handouts on classroom activities, was also developed [23]. This tutorial starts with an introductory level on modeling techniques, and goes into more detail on using the PID controller, anti-windup, feed-forward and trajectory generation. It provides a total of ten guided examples; some are projected as demonstrations during lectures while others are developed as exercises and as a basis for group discussion on more in-depth theoretical topics.

#### **5.1. Classroom examples**

Many are the classroom activities that can be performed by the tool presented. This subsection shows three classroom examples that illustrate the module's capabilities. Although these examples do not fully exploit all of the tool's features, they illustrate some important aspects of servo systems.

#### **Example-1: Modeling and open-loop simulation**

406 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

varying parameters, and give explanations through "what-if" scenarios.

The tool was used during the 2006-07 and 2007-08 academic years at Universidad Europea de Madrid (Spain), in control engineering and robotics subjects, providing the instructor with a valuable supplement to lectures by projecting the module screenshots. The first advantage of the tool presented here is that it allows the instructor to set up simulations with minimum effort, which obviously helps him to maintain the flow of the lecture, and allows him to pose different cases quickly in response to the students' questions. The module proved to be an effective instrument to facilitate teaching, since the interactive nature of the module helps to draw comparisons between simulations, explore the effect of

The learning module was also used by approximately 35 students in the classroom, following guided exercises. These exercises were focused on students getting a feel for the qualitative aspects of servo systems, having them explore what would happen if a given parameter were increased or decreased. The quantitative aspects were not emphasized as much. For example, students are asked to undertake the problem of position control and tracking trajectories. After a review of the PID controller, students are asked to tune the controller through a trial and error process, taking advantage of the interactivity of the tool. As a first step, students use proportional action (P) and examine steady-state error. Next, they introduce the integral action (I) to see how the steady-state error is eliminated. Finally, the derivative action (D) is activated to increase the dumping of the system. Robustness is also an important aspect in servo systems. In another exercise, simulations are performed to assess control strategy with respect to external disturbances, considering cases where a motor is holding a final position and a disturbance is applied to its shaft. Thanks to the module's interactivity, many other concepts such as flexible coupling, anti-windup and feed-forward corrections, or the use of S-curve references are presented with animated graphs examining the effects of some parameters. These exercises are solved in group, and the use of the interactive tool provides an excellent context for provoking discussions and

To foster interest in the use of the tool, a comprehensive tutorial, providing a number of handouts on classroom activities, was also developed [23]. This tutorial starts with an introductory level on modeling techniques, and goes into more detail on using the PID controller, anti-windup, feed-forward and trajectory generation. It provides a total of ten guided examples; some are projected as demonstrations during lectures while others are developed as exercises and as a basis for group discussion on more in-depth theoretical topics.

Many are the classroom activities that can be performed by the tool presented. This subsection shows three classroom examples that illustrate the module's capabilities. Although these examples do not fully exploit all of the tool's features, they illustrate some

**5. Classroom experience** 

reflections.

**5.1. Classroom examples** 

important aspects of servo systems.

Models are an essential element of servo system analysis and design, and serve to understand how systems behave with and without control. This aspect is covered through demonstrations shown during a lecture, carrying out comparisons of a motor's open-loop responses with rigid and flexible coupling, as well as observing dynamically how changes in the compliance parameter affects the shapes of the responses. Furthermore, different parameters of the model are taken into account and are changed dynamically in order to assess their effect in light of the modeling concept. Step responses of a DC motor with rigid and flexible coupling are shown in Figure. 8.

**Figure 8.** Step responses of a DC motor with rigid and flexible coupling (k = 0.7).

#### **Example-2: Speed control and anti-windup correction**

The tool is used to study velocity control and its characteristics. For example, one exercise is devoted to simulating PI control, applying poles placement strategy. The tuning parameters are adjusted analytically assuming a simplified model. Afterwards, students are required to compare simulation outputs applying the same controller tuning to the model with flexible coupling. In the context of speed control, another exercise is dedicated to demonstrating the benefits of anti-windup correction. In this section, students are required to compare the system's output under different conditions: namely, a simulation with no saturation limits, a simulation with saturation limits, and a simulation with anti-windup compensation. This comparison is illustrated in Figure. 9.

An Interactive Tool for Servo Systems Learning 409

**Figure 10.** Illustration of a parabolic velocity move profile with and without feed-forward. (P = 12.6, I =

0 1 2 3 4 5

Time

0 1 2 3 4 5

Reference

With no feedforward With feedforward

Position response

Time

Speed Response

The use of the interactive module, from the students' point of view, and how this contributes effectively to enhancing the learning of servo systems are important issues for the instructor. To this end, a qualitative assessment based on a focus group interview [24] and a traditional course survey were conducted by the instructor. Interviewing students constitutes an excellent way of assessing the use of the new learning module as well as learning outcomes. The interview consisted of discussing a set of open-ended questions with the students, raising two primary issues: the usability of the module and its effectiveness in learning. After the discussion, students were asked to give an evaluation (from 1 to 5) for each of the discussed questions. The assessment was conducted with two groups (a control engineering and robotics courses) during the second 2007 semester. In all, 34 students took

0.5, D = 4.25, Kv = 4.95, Ka = 0.85, T = 2).


0

0.2

Speed (rad/sec)

0.4

0.6

0.8

0

0.5

Position (rad)

1

1.5

**6. Assessment and evaluation** 

**Figure 9.** Speed control using a PI controller with and without anti-windup effect (P=1 I=7).

#### **Example-3: Parabolic velocity profiling and feed-forward**

Servo systems behavior is often characterized by their step responses. However, it is also useful to see how servo systems behave under S-curves, such as parabolic or trapezoidal profiles. Students are asked to investigate the effect of these trajectories and how input voltage and current are influenced. Lastly, activities concerning feed-forward compensation are also possible, demonstrating how near-zero tracking error can be achieved. Figure. 10 shows a comparison of position control through a parabolic profile, and illustrates the effect of feed-forward.

**Figure 10.** Illustration of a parabolic velocity move profile with and without feed-forward. (P = 12.6, I = 0.5, D = 4.25, Kv = 4.95, Ka = 0.85, T = 2).

#### **6. Assessment and evaluation**

408 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

**Figure 9.** Speed control using a PI controller with and without anti-windup effect (P=1 I=7).

Servo systems behavior is often characterized by their step responses. However, it is also useful to see how servo systems behave under S-curves, such as parabolic or trapezoidal profiles. Students are asked to investigate the effect of these trajectories and how input voltage and current are influenced. Lastly, activities concerning feed-forward compensation are also possible, demonstrating how near-zero tracking error can be achieved. Figure. 10 shows a comparison of position control through a parabolic profile, and illustrates the effect

0 1 2 3 4 5

Time

0 1 2 3 4 5

With no saturation limits With saturation limit: ± 5 volts With saturation limit & antiwindup

Speed

Time

Control signal

**Example-3: Parabolic velocity profiling and feed-forward** 

of feed-forward.

0

2

3

4

Voltage

5

6

7

0.5

1

1.5

speed (rad/sec

2

2.5

The use of the interactive module, from the students' point of view, and how this contributes effectively to enhancing the learning of servo systems are important issues for the instructor. To this end, a qualitative assessment based on a focus group interview [24] and a traditional course survey were conducted by the instructor. Interviewing students constitutes an excellent way of assessing the use of the new learning module as well as learning outcomes. The interview consisted of discussing a set of open-ended questions with the students, raising two primary issues: the usability of the module and its effectiveness in learning. After the discussion, students were asked to give an evaluation (from 1 to 5) for each of the discussed questions. The assessment was conducted with two groups (a control engineering and robotics courses) during the second 2007 semester. In all, 34 students took

part in the interview. The students' questionnaire and corresponding evaluations are summarized in Table 1.

An Interactive Tool for Servo Systems Learning 411

simulations. It also allows students to explore the effects of varying parameters and instantly observe their influence on the system's behavior. Interaction with the module is straightforward and is done essentially using sliders. This sort of interaction proved to be helpful since it stimulates the students, and it is found that the interactive tool provides a stronger motivation to learn than does the traditional use of Simulink blocks. Finally, extensive use of the module can give students an enhanced intuition and help to them to

gain better understanding of the qualitative aspects of servo systems.

and Javier Fernández Andrés

*(UEM), Villaviciosa de Odón, Madrid, Spain* 

distributed virtual laboratories, reusable and safe".

Systems. 5th ed, New Jersey: Prentice-Hall.

*Systems.* 3rd ed, Boston: Addison Wesley.

1st ed, New Jersey: Prentice Hall.

*Dpto: Sistemas Informáticos Automática y Comunicaciones, Universidad Europea de Madrid* 

*Dpto. Sistemas de Comunicación y Control, Escuela Técnica Superior Ingeniería Informática,* 

The authors wish to thank the Spanish Ministry of Science and Innovation and the National Plan R&D TIN2008-06083-C03/TSI "s-Labs: Integration of open services for remote and

[1] D. S. Bernstein, The Quanser DC motor Control Trainer (2005), *IEEE Cont. Syst. Mag.*,

[2] G. F Franklin, J. D. Powell, and A. Emami-Naeini, (2006), *A. Feedback Control of Dynamic* 

[3] F. L. Lewis, (1992), *Applied Optimal Control & Estimation: Digital Design & Implementation.*

[4] G. F. Franklin, J. D. Powell and M. L. Workman, (1997) *Digital Control of Dynamic* 

[6] B. Wittenmark, H. Hägglund, and M. Johansson, (1998), Dynamic pictures and

[7] M. Johansson, M. Gäfvert, and K. J. Åström, (1998), Interactive tools for education in

[8] S. Dormido, S. Dormido-Canto, R. Dormido-Canto, J. Sanchez, and N. Duro, (2005) The role of interactivity in control learning," *Int. J. Eng. Educ.*, vol. 21, no. 6, pp. 1122-

[5] R. N. Clark, (1997) *Control System Dynamics.* Cambridge: Cambridge University.

interactive learning, *IEEE Cont. Syst. Mag.*, vol. 18, no. 3, pp. 26-32.

automatic control, *IEEE Cont. Syst. Mag.*, vol. 18, no. 3, pp. 33-40.

**Author details** 

Nourdine Aliane\*

Rafael Pastor Vargas

**Acknowledgement** 

*UNED, Spain* 

**8. References** 

1133.

Corresponding Author

 \*

vol. 25, no. 3, pp. 90-94.


**Table 1.** Student questionnaire. The table gives the mean and the standard deviation of students' responses. The grading scale is from 1 (low) to 5 (high).

Concerning the usability of the module, students were receptive to using the new tool. The majority agreed that it is easy to use and does not add cognitive load. They also agreed that the use of a simulation module with a GUI is much better than directly using Simulink blocks, since it helps them to proceed quickly. Students agreed that its most valuable feature is the sliders provided as a means to explore the effects of varying parameters on system behavior. The companion tutorial, with its guided exercises, is also considered important for the correct use of the module. In this aspect, students presumably limit their instructional material to the tutorials designed by the teacher.

The results from the question on whether the module is useful for complementing lectures showed that students consider that interactive tools represent a convenient way of enhancing in-class sessions and bringing new dimensions to traditional teaching methods. The majority considered that the tool presented constitutes a good complement for lectures, and many of them advocated extending the use of such modules to more topics and subjects.

Concerning learning outcomes, students uniformly agreed that the module allowed them to pay more attention to simulation results, rather than to designing Simulink diagrams. Some students declared that the interactive feature of the module activated their curiosity to discover its contents. As the interaction with the module is driven mainly by sliders, students can explore the effects of a full range of parameters by adjusting the values from low to high, or vice versa. In this aspect, the majority believed that this routine enables them to perceive clearly the qualitative aspects of servo systems. Finally, many students agreed that the tool helped them to understand servo systems problems, and many of them felt that the interactive module was an effective learning medium.

## **7. Conclusion**

In this paper, the development of a Matlab/Simulink-GUI application for servo systems learning is described, and its use in the classroom is also addressed. The tool exposes students to servo systems concepts and allows them to experience a variety of practical scenarios. Its principal feature is that it dramatically reduces the effort needed to specify simulations. It also allows students to explore the effects of varying parameters and instantly observe their influence on the system's behavior. Interaction with the module is straightforward and is done essentially using sliders. This sort of interaction proved to be helpful since it stimulates the students, and it is found that the interactive tool provides a stronger motivation to learn than does the traditional use of Simulink blocks. Finally, extensive use of the module can give students an enhanced intuition and help to them to gain better understanding of the qualitative aspects of servo systems.

## **Author details**

410 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 3

summarized in Table 1.

subjects.

**7. Conclusion** 

responses. The grading scale is from 1 (low) to 5 (high).

material to the tutorials designed by the teacher.

the interactive module was an effective learning medium.

part in the interview. The students' questionnaire and corresponding evaluations are

Concerning the usability of the module, students were receptive to using the new tool. The majority agreed that it is easy to use and does not add cognitive load. They also agreed that the use of a simulation module with a GUI is much better than directly using Simulink blocks, since it helps them to proceed quickly. Students agreed that its most valuable feature is the sliders provided as a means to explore the effects of varying parameters on system behavior. The companion tutorial, with its guided exercises, is also considered important for the correct use of the module. In this aspect, students presumably limit their instructional

The results from the question on whether the module is useful for complementing lectures showed that students consider that interactive tools represent a convenient way of enhancing in-class sessions and bringing new dimensions to traditional teaching methods. The majority considered that the tool presented constitutes a good complement for lectures, and many of them advocated extending the use of such modules to more topics and

Concerning learning outcomes, students uniformly agreed that the module allowed them to pay more attention to simulation results, rather than to designing Simulink diagrams. Some students declared that the interactive feature of the module activated their curiosity to discover its contents. As the interaction with the module is driven mainly by sliders, students can explore the effects of a full range of parameters by adjusting the values from low to high, or vice versa. In this aspect, the majority believed that this routine enables them to perceive clearly the qualitative aspects of servo systems. Finally, many students agreed that the tool helped them to understand servo systems problems, and many of them felt that

In this paper, the development of a Matlab/Simulink-GUI application for servo systems learning is described, and its use in the classroom is also addressed. The tool exposes students to servo systems concepts and allows them to experience a variety of practical scenarios. Its principal feature is that it dramatically reduces the effort needed to specify

**Nº. Questions score**  1 The module is easy to use. 3.91 (0.79) 2 The module is productive and allows setting up simulations quickly. 3.56 (0.93) 3 The module is useful for complementing lectures. 3.88 (1.01) 4 The module gave me more motivation to learn. 3.79 (0.77) 5 Overall, the module helped me to learn servo systems. 3.88 (0.88) **Table 1.** Student questionnaire. The table gives the mean and the standard deviation of students'

> Nourdine Aliane\* and Javier Fernández Andrés *Dpto: Sistemas Informáticos Automática y Comunicaciones, Universidad Europea de Madrid (UEM), Villaviciosa de Odón, Madrid, Spain*

> Rafael Pastor Vargas *Dpto. Sistemas de Comunicación y Control, Escuela Técnica Superior Ingeniería Informática, UNED, Spain*

## **Acknowledgement**

The authors wish to thank the Spanish Ministry of Science and Innovation and the National Plan R&D TIN2008-06083-C03/TSI "s-Labs: Integration of open services for remote and distributed virtual laboratories, reusable and safe".

## **8. References**


<sup>\*</sup> Corresponding Author

	- [9] J. L. Guzmán, K. J. Åström, S. Dormido, T. Hägglund, and Y. Piguet, (2008), Interactive learning modules for PID control, *IEEE Cont. Syst. Mag.*, vol. 28, no. 5, pp. 118-134.
	- [10] T. Kikuchi, T. Kenjo and S. Fukuda, (2002), "Developing an educational simulation program for the PM stepping motor," *IEEE Trans. Educ.*, vol 45, no 1, pp-70-78.
	- [11] S. Ayasun and C. O. Nwankpa, (2005), Induction motor tests using Matlab/Simulink and their integration into undergraduate electric machinery courses, *IEEE Trans. Educ.*, vol 48, no 1, pp. 37–46.
	- [12] N. Patrascoiu, (2005), Modeling and Simulation of the DC Motor Using Matlab and LabVIEW," *Int. J. Eng. Educ.*, vol 21, no 1, pp. 49-54.
	- [13] D. Hercog and K. Jezernik, (2005), Rapid Control Prototyping using Matlab/Simulink and DSP-based Motor Control," *Int. J. Eng. Educ*., vol. 21 no. 4, pp.596-605.
	- [14] MATLAB-Central-File-Exchange [on-line], Retrieved March 2012 from: http://www.mathworks.com/matlabcentral/fileexchange
	- [15] Casini, M. y D. Prattichizzo, (2003), The automatic control Telelab: A user-friendly interface for distance learning," *IEEE Trans. Educ.*, vol.46, no. 2, pp. 252-257.
	- [16] R. Pastor, C. Martín, J. Sánchez, and S. Dormido, (2005), Development of a XML-based lab for remote control experiments on a servo motor, *Int. J. Elect. Eng. Educ.*, vol. 42, nº 2, pp. 173-184.
	- [17] R. Kelly and J. Moreno, (2001), Learning PID structures in an introductory course of automatic control," *IEEE Trans. Educ.*, vol. 44, no. 4, pp. 373-376.

**1. Introduction**

http://dx.doi.org/10.5772/46457

Eric Anterrieu

electrodynamics [2] as well as in non-linear optics [3].

**2. Ordinary differential equations in Matlab**

cited.

Real experiments are sometimes missing or highly expensive to implement when teaching modern physics. This is an important issue, especially when the theories are not intuitive. However, with the incorporation of computers into the classroom it has become much easier to illustrate some amazing effects of modern physics that cannot be brought to the attention of students without the aid of numerical simulations. Thanks to the performance of MATLAB langage, as well as to the easiness to code a theoretical problem, the students can really conduct numerical expriments and play with them almost in real time. This computer-based teaching approach is illustrate here with the capabilities to use MATLAB for solving initial values problems of ordinary differential equations encountered in relativistic

**Illustrating Amazing Effects of Modern** 

**Physics with Numerical Simulations** 

**Conducted in the Classroom** 

Additional information is available at the end of the chapter

In mathematics, an ordinary differential equation (or ODE) is a relation *f* that contains one or more derivatives of a dependent variable *y* with respect to a single independent variable *t*, usually referred to as time. Many studies have been devoted to the solution of ODEs. In the case where the equation is linear, it can be solved by analytical methods. Unfortunately, most of the interesting ODEs are non-linear and, with a few exceptions, cannot be solved analytically. However, in science and in engineering, a numeric approximation to the solution is often good enough to solve a problem. Numerical integration is that part of numerical analysis which studies the numerical solutions of ODEs with the aid of iterative solvers.

MATLAB offers several numerical algorithms to solve a wide variety of ODEs. These solvers are designed to handle only explicit ODEs of the form *y*� = *f*(*t*, *y*), linearly implicit ODEs of

> ©2012 Anterrieu, licensee InTech. This is an open access chapter distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0),which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly

©2012 Anterrieu, licensee InTech. This is a paper distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

) = 0. Generally

**Chapter 17**

the form *M*(*t*, *y*)· *y*� = *f*(*t*, *y*) as well as fully implicit ones of the form *f*(*t*, *y*, *y*�

