0% found this document useful (0 votes)
39 views86 pages

Matlab Programming For Engineers 6th Edition Stephen J Chapman Download

The document provides information about the sixth edition of 'MATLAB Programming for Engineers' by Stephen J. Chapman, which focuses on teaching MATLAB as a technical programming language for engineering students. It highlights the book's structure, including introductory chapters for beginners and advanced topics, as well as significant updates in the latest edition such as new features in MATLAB R2018a. Additionally, the book emphasizes good programming practices, the use of functions, and provides pedagogical features to aid student comprehension.

Uploaded by

mapejabahere92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views86 pages

Matlab Programming For Engineers 6th Edition Stephen J Chapman Download

The document provides information about the sixth edition of 'MATLAB Programming for Engineers' by Stephen J. Chapman, which focuses on teaching MATLAB as a technical programming language for engineering students. It highlights the book's structure, including introductory chapters for beginners and advanced topics, as well as significant updates in the latest edition such as new features in MATLAB R2018a. Additionally, the book emphasizes good programming practices, the use of functions, and provides pedagogical features to aid student comprehension.

Uploaded by

mapejabahere92
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 86

Matlab Programming For Engineers 6th Edition

Stephen J Chapman download

https://ebookbell.com/product/matlab-programming-for-
engineers-6th-edition-stephen-j-chapman-34563734

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Matlab Programming For Engineers 4th Ed Stephen J Chapman

https://ebookbell.com/product/matlab-programming-for-engineers-4th-ed-
stephen-j-chapman-10204178

Matlab Programming For Engineers 3rd Edition Stephen J Chapman

https://ebookbell.com/product/matlab-programming-for-engineers-3rd-
edition-stephen-j-chapman-1901944

Matlab Programming For Engineers B010562 Stephen Jchapman

https://ebookbell.com/product/matlab-programming-for-
engineers-b010562-stephen-jchapman-1511158

Matlab Programming With Matlab For Beginners A Practical Introduction


To Programming And Problem Solving Matlab For Engineers Matlab For
Scientists Matlab Programming For Dummies Learning

https://ebookbell.com/product/matlab-programming-with-matlab-for-
beginners-a-practical-introduction-to-programming-and-problem-solving-
matlab-for-engineers-matlab-for-scientists-matlab-programming-for-
dummies-learning-231836404
Matlab Programming For Biomedical Engineers And Scientists 1st Edition
Andrew P King And Paul Aljabar Auth

https://ebookbell.com/product/matlab-programming-for-biomedical-
engineers-and-scientists-1st-edition-andrew-p-king-and-paul-aljabar-
auth-6614656

Matlab Programming For Biomedical Engineers And Scientists Andrew P


King

https://ebookbell.com/product/matlab-programming-for-biomedical-
engineers-and-scientists-andrew-p-king-11047154

Matlab Programming With Applications For Engineers 1st Edition Stephen


J Chapman

https://ebookbell.com/product/matlab-programming-with-applications-
for-engineers-1st-edition-stephen-j-chapman-4705226

Programming For Engineers A Foundational Approach To Learning C And


Matlab 1st Edition Aaron R Bradley Auth

https://ebookbell.com/product/programming-for-engineers-a-
foundational-approach-to-learning-c-and-matlab-1st-edition-aaron-r-
bradley-auth-2341136

An Introduction To Matlab Programming And Numerical Methods For


Engineers 1st Edition Timmy Siauw

https://ebookbell.com/product/an-introduction-to-matlab-programming-
and-numerical-methods-for-engineers-1st-edition-timmy-siauw-4674904
MATLAB®
Programming
for Engineers
MATLAB®
Programming
for Engineers
Sixth Edition

Stephen J. Chapman
BAE Systems Australia

Australia • Brazil • Mexico • Singapore • Spain • United Kingdom • United States


MATLAB Programming for Engineers, © 2020, 2016, 2008 Cengage Learning, Inc.
Sixth Edition
Stephen J. Chapman Unless otherwise noted, all content is © Cengage

Product Director, Global Engineering: ALL RIGHTS RESERVED. No part of this work covered by the
Timothy L. Anderson copyright herein may be reproduced or distributed in any form

Senior Product Assistant: Alexander or by any means, except as permitted by U.S. copyright law,

Sham without the prior written permission of the copyright owner.

Content Developer: MariCarmen


Constable
For product information and technology assistance, contact us at
Associate Marketing Manager: Tori Cengage Customer & Sales Support, 1-800-354-9706
Sitcawich or support.cengage.com.

Content Manager: Marianne Groth


For permission to use material from this text or product,
IP Analyst: Nancy Dillon
submit all
IP Project Manager: Jillian Shafer requests online at www.cengage.com/permissions.

Production Service: RPK Editorial


Services, Inc. Library of Congress Control Number: 2018965078

Compositor: MPS Limited

Senior Designer: Diana Graham Student Edition:


ISBN: 978-0-357-03039-4
Cover Image: iStockPhoto.com/
Henrik5000 Loose-leaf Edition:
Manufacturing Planner: Doug Wilke ISBN: 978-0-357-03051-6

Cengage
20 Channel Center Street
Boston, MA 02210
USA

Cengage is a leading provider of customized learning solutions


with employees residing in nearly 40 different countries and
sales in more than 125 countries around the world. Find your
local representative at www.cengage.com.

Cengage products are represented in Canada by Nelson


Education, Ltd.

To learn more about Cengage platforms and services, register


or access your online learning solution, or purchase materials
for your course, visit www.cengage.com.

MATLAB is a registered trademark of The MathWorks, Inc.,


1 Apple Hill Drive, Natick, MA 01760-2098

Printed in the United States of America


Print Number: 01   Print Year: 2018
This book is dedicated with love to my youngest daughter Devorah,
who just finished high school. The last one!
Preface

MATLAB (short for MATrix LABoratory) is a special-purpose computer program


optimized to perform engineering and scientific calculations. It started life as a pro-
gram designed to perform matrix mathematics, but over the years it has grown into
a flexible computing system capable of solving essentially any technical problem.
The MATLAB program implements the MATLAB language and provides an
extensive library of predefined functions to make technical programming tasks
easier and more efficient. This extremely wide variety of functions makes it much
easier to solve technical problems in MATLAB than in other languages such as
Fortran or C. This book introduces the MATLAB language as it is implemented in
version R2018a and shows how to use it to solve typical technical problems.
This book teaches MATLAB as a technical programming language, showing
students how to write clean, efficient, and documented programs. It makes no pre-
tense at being a complete description of all of MATLAB’s hundreds of functions.
Instead, it teaches the student how to use MATLAB as a computer language and
how to locate any desired function with MATLAB’s extensive on-line help facilities.
The first eight chapters of the text are designed to serve as the text for an
“Introduction to Programming/Problem Solving” course for freshman engineer-
ing students. This material should fit comfortably into a 9-week, 3-hour-per-week
course. The remaining chapters cover advanced topics such as I/O, object-oriented
programming, and graphical user interfaces (GUIs). These chapters may be covered
in a longer course or used as a reference by engineering students or practicing engi-
neers who use MATLAB as a part of their coursework or employment.

Changes in the Sixth Edition


The sixth edition of this book is specifically devoted to MATLAB R2018a. In
the four years since the last release, there have been many changes in MATLAB.
vii
viii | Preface

The most significant of these changes include the introduction of the App
Designer, which includes a whole new paradigm for creating MATLAB apps; a
new family of plotting functions; and strings. There have also been many smaller
improvements throughout the program. The book has been revised to reflect
these changes.
The major changes in this edition of the book include:
■■ An increase in the number of MATLAB applications featured in the chapters,
with more end-of-chapter exercises using them.
■■ More extensive coverage of plots in Chapter 3 and Chapter 8. The discussion

now includes most of the currently recommended plot types in MATLAB.


Older deprecated plot types have been dropped from coverage as the new ones
have been added.
■■ Coverage of the new string data type, along with changes in the support for

character arrays.
■■ Coverage of the time data types: dateTime, duration, and
calendarDuration.
■■ Coverage of table arrays.

■■ A completely rewritten Chapter 14 featuring the new App Designer and class-

based GUIs.
■■ An extra on-line Chapter 15 featuring the older GUIDE-based GUIs; this

chapter can be downloaded from the book’s website.

The Advantages of MATLAB for Technical Programming


MATLAB has many advantages compared to conventional computer languages for
technical problem solving. Among them are:
1. Ease of Use
MATLAB is an interpreted language, like many versions of Basic. Like
Basic, it is very easy to use. The program can be used as a scratch pad to
evaluate expressions typed at the command line, or it can be used to execute
large pre-written programs. Programs may be easily written and modified
with the built-in integrated development environment and debugged with the
MATLAB debugger. Because the language is so easy to use, it is ideal for
educational use and for the rapid prototyping of new programs.
Many program development tools are provided to make the program
easy to use. They include an integrated editor/debugger, on-line documenta-
tion and manuals, a workspace browser, and extensive demos.
2. Platform Independence
MATLAB is supported on many different computer systems, providing a
large measure of platform independence. At the time of this writing, the
language is supported on Windows 7/8/10, Linux, and the Mac. Programs
written on any platform will run on all of the other platforms, and data files
written on any platform may be read transparently on any other platform.
Preface | ix

As a result, programs written in MATLAB can migrate to new platforms


when the needs of the user change.
3. Predefined Functions
MATLAB comes complete with an extensive library of predefined functions
that provide tested and prepackaged solutions to many basic technical tasks.
For example, suppose that you are writing a program that must calculate the
statistics associated with an input data set. In most languages, you would
need to write your own subroutines or functions to implement calculations
such as the arithmetic mean, standard deviation, median, and so forth. These
and hundreds of other functions are built right into the MATLAB language,
making your job much easier.
In addition to the large library of functions built into the basic
MATLAB language, there are many special-purpose toolboxes available to
help solve complex problems in specific areas. For example, a user can buy
standard toolboxes to solve problems in Signal Processing, Control Sys-
tems, Communications, Image Processing, and Neural Networks, among
many others.
4. Device-Independent Plotting
Unlike other computer languages, MATLAB has many integral plotting and
imaging commands. The plots and images can be displayed on any graphi-
cal output device supported by the computer on which MATLAB is running.
This capability makes MATLAB an outstanding tool for visualizing techni-
cal data.
5. Graphical User Interface
MATLAB includes tools that allow a programmer to interactively construct a
GUI for his or her program. With this capability, the programmer can design
sophisticated data analysis programs that can be operated by relatively inex-
perienced users.

Features of This Book


Many features of this book are designed to emphasize the proper way to write reli-
able MATLAB programs. These features should serve a student well as he or she
is first learning MATLAB and should also be useful to the practitioner on the job.
These features include:
1. Emphasis on Top-Down Design Methodology
The book introduces a top-down design methodology in Chapter 4 and
then uses it consistently throughout the rest of the book. This methodology
encourages a student to think about the proper design of a program before
beginning to code. It emphasizes the importance of clearly defining the
problem to be solved and the required inputs and outputs before any other
work is begun. Once the problem is properly defined, the methodology
teaches the student to employ stepwise refinement to break the task down
x | Preface

into successively smaller sub-tasks, and to implement the sub-tasks as sepa-


rate subroutines or functions. Finally, it teaches the importance of testing
at all stages of the process, both unit testing of the component routines and
exhaustive testing of the final product.
The formal design process taught by the book may be summarized as
follows:
1. Clearly state the problem that you are trying to solve.
2. Define the inputs required by the program and the outputs to be pro-
duced by the program.
3. Describe the algorithm that you intend to implement in the program.
This step involves top-down design and stepwise decomposition,
using pseudocode or flow charts.
4. Turn the algorithm into MATLAB statements.
5. Test the MATLAB program. This step includes unit testing of specific
functions as well as exhaustive testing of the final program with many
different data sets.
2. Emphasis on Functions
The book emphasizes the use of functions to logically decompose tasks
into smaller subtasks. It teaches the advantages of functions for data hid-
ing. It also emphasizes the importance of unit testing functions before
they are combined into the final program. In addition, the book teaches
about the common mistakes made with functions and how to avoid them.
3. Emphasis on MATLAB Tools
The book teaches the proper use of MATLAB’s built-in tools to make
programming and debugging easier. The tools covered include the Editor/
Debugger, Workspace Browser, Help Browser, and GUI design tools.
4. Good Programming Practice Boxes
These boxes highlight good programming practices when they are intro-
duced for the convenience of the student. In addition, the good programming
practices introduced in a chapter are summarized at the end of the chapter.
An example Good Programming Practice Box is as follows:

Good Programming Practice


Always indent the body of an if construct by two or more spaces to improve the
readability of the code.

5. Programming Pitfalls Boxes


These boxes highlight common errors so that they can be avoided. An
example Programming Pitfalls Box is as follows:
Preface | xi

Programming Pitfalls
Make sure that your variable names are unique in the first 31 characters. Otherwise,
MATLAB will not be able to tell the difference between them.

6. Emphasis on Data Structures


Chapter 10 contains a detailed discussion of MATLAB data structures,
including sparse arrays, cell arrays, and structure arrays. The proper use
of these data structures is illustrated in the chapters on handle graphics
(Chapter 13) and graphical user interfaces (Chapter 14).
7. Emphasis on Object-Oriented MATLAB
Chapter 12 includes an introduction to object-oriented programming (OOP)
and describes the MATLAB implementation of OOP in detail. This informa-
tion is then applied in the discussion of App Designer GUIs.

Pedagogical Features
The first eight chapters of this book are specifically designed to be used in a fresh-
man “Introduction to Program/Problem Solving” course. It should be possible to
cover this material comfortably in a 9-week, 3-hour-per-week course. If there is
insufficient time to cover all of the material in a particular Engineering program,
Chapter 8 may be omitted, and the remaining material will still teach the fundamen-
tals of programming and using MATLAB to solve problems. This feature should
appeal to harassed engineering educators trying to cram ever more material into a
finite curriculum.
The remaining chapters cover advanced material that will be useful to the
engineer and engineering students as they progress in their careers. This material
includes advanced I/O, object-oriented programming, and the design of GUIs for
programs.
The book includes several features designed to aid student comprehension. A
total of 20 quizzes appear scattered throughout the chapters, with answers to all
questions included in Appendix B. These quizzes can serve as a useful self-test of
comprehension. In addition, there are approximately 230 end-of-chapter exercises.
Answers to all exercises are included in the Instructor’s Solutions Manual. Good
programming practices are highlighted in all chapters with special Good Program-
ming Practice boxes, and common errors are highlighted in Programming Pitfalls
boxes. End-of-chapter materials include Summaries of Good Programming Practice
and Summaries of MATLAB Commands and Functions.
The book is accompanied by an Instructor’s Solutions Manual, which contains
the solutions to all end-of-chapter exercises. The source code for all examples in
xii | Preface

the book is available from the book’s website at https://login.cengage.com, and the
source code for all solutions in the Instructor’s Manual is available separately to
instructors.

A Final Note to the User


No matter how hard I try to proofread a document like this book, it is inevitable that
some typographical errors will slip through and appear in print. If you should spot
any such errors, please drop me a note via the publisher, and I will do my best to
get these errors eliminated from subsequent printings and editions. Thank you very
much for your help in this matter.
I will maintain a complete list of errata and corrections at the book’s website,
which is available through https://login.cengage.com. Please check that site for any
updates and/or corrections.

Acknowledgments
I would like to thank all my friends at Cengage Learning for the support they have
given me in getting this book to market.
In addition, I would like to thank my wife Rosa, and our children Avi, David,
Rachel, Aaron, Sarah, Naomi, Shira, and Devorah for their help and encouragement.

Stephen J. Chapman
Melbourne, Australia
Digital Resources

New Digital Solution for Your Engineering Classroom


WebAssign is a powerful digital solution designed by educators to enrich the engi-
neering teaching and learning experience. With a robust computational engine at
its core, WebAssign provides extensive content, instant assessment, and superior
support.
WebAssign’s powerful question editor allows engineering instructors to cre-
ate their own questions or modify existing questions. Each question can use any
combination of text, mathematical equations and formulas, sound, pictures, video,
and interactive HTML elements. Numbers, words, phrases, graphics, and sound or
video files can be randomized so that each student receives a different version of
the same question.
In addition to common question types such as multiple choice, fill-in-
the-blank, essay, and numerical, you can also incorporate robust answer entry
palettes (­mathPad, chemPad, calcPad, physPad, pencilPad, Graphing Tool) to
input and grade symbolic expressions, equations, matrices, and chemical struc-
tures using powerful computer algebra systems. You can even use ­Camtasia to
embed “clicker” questions that are automatically scored and recorded in the
­GradeBook.

xiii
xiv | Digital Resources

WebAssign Offers Engineering Instructors the Following


■■ The ability to create and edit algorithmic and numerical exercises.
■■ The opportunity to generate randomized iterations of algorithmic and numeri-
cal exercises. When instructors assign numerical WebAssign homework exer-
cises (­engineering math exercises), the WebAssign program offers them the
ability to generate and assign their students differing versions of the same
engineering math exercise. The computational engine extends beyond and
provides the luxury of solving for correct solutions/answers.
■■ The ability to create and customize numerical questions, allowing students to

enter units, use a specific number of significant digits, use a specific number of
decimal places, respond with a computed answer, or answer within a different
tolerance value than the default.
Visit https://www.webassign.com/instructors/features/ to learn more. To create an account,
instructors can go directly to the signup page at http://www.webassign.net/signup.html.

MindTap Reader
Available via WebAssign and our digital subscription service, Cengage Unlimited,
MindTap Reader is Cengage’s next-generation eBook for engineering students.
The MindTap Reader provides more than just text learning for the student. It
offers a variety of tools to help our future engineers learn chapter concepts in a way
that ­resonates with their workflow and learning styles.
■■ Personalize their ­experience
Within the MindTap Reader, students can h­ ighlight key concepts, add notes, and
bookmark pages. These are collected in My Notes, ensuring they will have their own
study guide when it comes time to study for exams.
Digital Resources | xv

■■ Flexibility at their fingertips


With access to Merriam-Webster’s Dictionary and the book’s internal glossary,
students can personalize their study experience by creating and collating their own
custom flashcards. The ReadSpeaker feature reads text aloud to students, so they can
learn on the go—wherever they are.

■■ Review concepts at point of use


Within WebAssign, a “Read It” button at the bottom of each question links students
to corresponding sections of the textbook, enabling access to the MindTap Reader
at the precise moment of learning. A “Watch It” button causes a short video to play.
These videos allow students to better understand and review the problem they need
to complete, enabling support at the precise moment of learning.
xvi | Digital Resources

The MindTap Mobile App


Available on iOS and Android smartphones, the MindTap Mobile App provides
convenience. Students can access their entire textbook anyplace and anytime. They
can take notes, highlight important passages, and have their text read aloud whether
they are on-line or off.
To download the mobile app, visit https://www.cengage.com/mindtap
/mobileapp.

All-You-Can-Learn Access with Cengage Unlimited


Cengage Unlimited is the first-of-its-kind digital subscription that gives students
total and on-demand access to all the digital learning platforms, eBooks, on-line
homework, and study tools Cengage has to offer—in one place, for one price. With
Cengage ­Unlimited, students get access to their WebAssign courseware, as well as
content in other Cengage platforms and course areas from day one. That’s 70 disci-
plines and 675 courses worth of material, including engineering.
With Cengage Unlimited, students get unlimited access to a library of more than
22,000 products. To learn more, visit https://www.cengage.com/unlimited.
Contents

Chapter 1 Introduction to MATLAB 1


1.1 The Advantages of MATLAB 2
1.2 Disadvantages of MATLAB 3
1.3 The MATLAB Environment 4
1.3.1 The MATLAB Desktop 4
1.3.2 The Command Window 6
1.3.3 The Toolstrip 7
1.3.4 The Command History Window 8
1.3.5 The Document Window 8
1.3.6 Figure Windows 11
1.3.7 Docking and Undocking Windows 12
1.3.8 The MATLAB Workspace 12
1.3.9 The Workspace Browser 14
1.3.10 The Current Folder Browser 14
1.3.11 Getting Help 15
1.3.12 A Few Important Commands 18
1.3.13 The MATLAB Search Path 19
1.4 Using MATLAB as a Calculator 21
1.5 MATLAB Script Files 23
1.5.1 Setting Up a Problem to Solve 24
1.5.2 Creating a Simple MATLAB Script File 24
1.6 Summary 28
1.6.1 MATLAB Summary 28
1.7 ­­Exercises 29

Chapter 2 MATLAB Basics 33


2.1 Variables and Arrays 33
xvii
xviii | Contents

2.2 Creating and Initializing Variables in MATLAB 37


2.2.1 Initializing Variables in Assignment Statements 37
2.2.2 Initializing with Shortcut Expressions 40
2.2.3 Initializing with Built-In Functions 41
2.2.4 Initializing Variables with Keyboard Input 41
2.3 Multidimensional Arrays 43
2.3.1 Storing Multidimensional Arrays in Memory 45
2.3.2 Accessing Multidimensional Arrays with One
Dimension 46
2.4 Subarrays 46
2.4.1 The end Function 47
2.4.2 Using Subarrays on the Left-Hand Side of an Assignment
Statement 47
2.4.3 Assigning a Scalar to a Subarray 49
2.5 Special Values 49
2.6 Displaying Output Data 51
2.6.1 Changing the Default Format 52
2.6.2 The disp Function 53
2.6.3 Formatted Output with the fprintf Function 54
2.7 Data Files 55
2.8 Scalar and Array Operations 58
2.8.1 Scalar Operations 58
2.8.2 Array and Matrix Operations 58
2.9 Hierarchy of Operations 62
2.10 Built-in MATLAB Functions 65
2.10.1 Optional Results 65
2.10.2 Using MATLAB Functions with Array Inputs 65
2.10.3 Common MATLAB Functions 66
2.11 Introduction to Plotting 67
2.11.1 Using Simple xy Plots 68
2.11.2 Printing a Plot 69
2.11.3 Multiple Plots 70
2.11.4 Line Color, Line Style, Marker Style, and Legends 71
2.12 Examples 75
2.13 MATLAB Applications:Vector Mathematics 82
2.13.1 Vector Addition and Subtraction 84
2.13.2 Vector Multiplication 85
2.14 MATLAB Applications: Matrix Operations
and Simultaneous Equations 90
2.14.1 The Matrix Inverse 91
2.15 Debugging MATLAB Programs 92
2.16 Summary 94
2.16.1 Summary of Good Programming Practice 95
2.16.2 MATLAB Summary 96
2.17 Exercises 99
Contents | xix

Chapter 3 Two-Dimensional Plots 111


3.1 Additional Plotting Features for Two-Dimensional Plots 111
3.1.1 Logarithmic Scales 111
3.1.2 Controlling x- and y-axis Plotting Limits 116
3.1.3 Plotting Multiple Plots on the Same Axes 117
3.1.4 Creating Multiple Figures 117
3.1.5 Subplots 121
3.1.6 Controlling the Spacing between Points on a Plot 122
3.1.7 Enhanced Control of Plotted Lines 126
3.1.8 Enhanced Control of Text Strings 127
3.2 Polar Plots 130
3.3 Annotating and Saving Plots 132
3.4 Additional Types of Two-Dimensional Plots 135
3.5 Using the plot Function with Two-Dimensional Arrays 140
3.6 Plots with Two y Axes 142
3.7 Summary 149
3.7.1 Summary of Good Programming Practice 150
3.7.2 MATLAB Summary 151
3.8 Exercises 151

Chapter 4 Branching Statements and Program Design 157


4.1 Introduction to Top-Down Design Techniques 157
4.2 Use of Pseudocode 161
4.3 The logical Data Type 162
4.3.1 Relational and Logic Operators 162
4.3.2 Relational Operators 163
4.3.3 A Caution About the == and ~= Operators 164
4.3.4 Logic Operators 165
4.3.5 Logical Functions 169
4.4 Branches 171
4.4.1 The if Construct 171
4.4.2 Examples Using if Constructs 173
4.4.3 Notes Concerning the Use of if Constructs 179
4.4.4 The switch Construct 182
4.4.5 The try/catch Construct 183
4.5 More on Debugging MATLAB Programs 189
4.6 Code Sections 196
4.7 MATLAB Applications: Roots of Polynomials 198
4.8 Summary 201
4.8.1 Summary of Good Programming Practice 201
4.8.2 MATLAB Summary 202
4.9 Exercises 203
xx | Contents

Chapter 5 Loops and Vectorization 207


5.1 The while Loop 207
5.2 The for Loop 213
5.2.1 Details of Operation 220
5.2.2 Vectorization: A Faster Alternative to Loops 222
5.2.3 The MATLAB Just-In-Time (JIT) Compiler 223
5.2.4 The break and continue Statements 227
5.2.5 Nesting Loops 228
5.3 Logical Arrays and Vectorization 229
5.3.1 Creating the Equivalent of if/else Constructs
with Logical Arrays 230
5.4 The MATLAB Profiler 232
5.5 Additional Examples 235
5.6 The textread Function 250
5.7 MATLAB Applications: Statistical Functions 252
5.8 MATLAB Applications: Curve Fitting and Interpolation 255
5.8.1 General Least-Squares Fits 255
5.8.2 Cubic Spline Interpolation 262
5.8.3 Interactive Curve-Fitting Tools 267
5.9 Summary 271
5.9.1 Summary of Good Programming Practice 271
5.9.2 MATLAB Summary 272
5.10 Exercises 272

Chapter 6 Basic User-Defined Functions 283


6.1 Introduction to MATLAB Functions 284
6.2 Variable Passing in MATLAB:The Pass-by-Value Scheme 290
6.3 Optional Arguments 300
6.4 Sharing Data Using Global Memory 305
6.5 Preserving Data between Calls to a Function 313
6.6 Built-In MATLAB Functions: Sorting Functions 318
6.7 Built-In MATLAB Functions: Random Number Functions 320
6.8 Summary 320
6.8.1 Summary of Good Programming Practice 321
6.8.2 MATLAB Summary 321
6.9 Exercises 322

Chapter 7 Advanced Features of User-Defined Functions 331


7.1 Function Functions 331
7.2 Function Handles 336
Contents | xxi

7.3 Functions eval and feval 341


7.4 Local Functions, Private Functions, and Nested Functions 342
7.4.1 Local Functions 342
7.4.2 Private Functions 344
7.4.3 Nested Functions 345
7.4.4 Order of Function Evaluation 348
7.4.5 Function Handles and Nested Functions 348
7.4.6 The Significance of Function Handles 350
7.5 An Example Application: Solving Ordinary
Differential Equations 351
7.6 Anonymous Functions 358
7.7 Recursive Functions 359
7.8 Plotting Functions 360
7.9 Histograms 362
7.10 An Example Application: Numerical Integration 368
7.11 Summary 374
7.11.1 Summary of Good Programming Practice 374
7.11.2 MATLAB Summary 375
7.12 Exercises 375

Chapter 8 Complex Numbers and Additional Plots 385


8.1 Complex Data 385
8.1.1 Complex Variables 387
8.1.2 Using Complex Numbers with Relational Operators 387
8.1.3 Complex Functions 388
8.1.4 Plotting Complex Data 394
8.2 Multidimensional Arrays 397
8.3 Gallery of MATLAB Plots 399
8.4 Line Plots 410
8.4.1 The plot3 Function 410
8.4.2 Changing the Viewpoint of Three-dimensional Plots 414
8.4.3 The fplot3 Function 414
8.4.4 The fimplicit Function 415
8.5 Discrete Data Plots 417
8.5.1 The stem3 Function 419
8.5.2 The scatter Function 420
8.5.3 The scatter3 Function 424
8.6 Polar Plots 426
8.6.1 The compass Function 429
8.6.2 The ezpolar Function 429
8.7 Contour Plots 431
8.7.1 Function contour 431
8.7.2 Function contourf 433
xxii | Contents

8.7.3 Function contour3 435


8.7.4 Function fcontour 435
8.8 Surface and Mesh Plots 436
8.8.1 Creating Surface and Mesh Plots 437
8.8.2 Creating Three-Dimensional Objects using Surface
and Mesh Plots 442
8.8.3 Ribbon Plots 444
8.8.4 Function pcolor 445
8.8.5 Functions fsurf and fmesh 447
8.8.6 Function fimplicit3 448
8.9 Pie Charts, Bar Plots, and Histograms 450
8.9.1 The area Function 451
8.9.2 Bar Plots 452
8.9.3 Two-Dimensional Histograms 456
8.10 Color Order, Color Maps, and Color Bars 457
8.10.1 Plot Color Order 457
8.10.2 Color Maps 459
8.10.3 Color Bars 459
8.11 Summary 463
8.11.1 Summary of Good Programming Practice 463
8.11.2 MATLAB Summary 463
8.12 Exercises 464

Chapter 9 Additional Data Types 471


9.1 Character Arrays versus Strings 472
9.1.1 Character Arrays 472
9.1.2 Strings 473
9.2 Character Arrays and Character Functions 473
9.2.1 Character Array Conversion Functions 474
9.2.2 Creating Two-Dimensional Character Arrays 475
9.2.3 Concatenating Character Arrays 476
9.2.4 Comparing Character Arrays 476
9.2.5 Searching/Replacing Characters within a Character Array 480
9.2.6 Uppercase and Lowercase Conversion 481
9.2.7 Trimming Whitespace from Strings 482
9.2.8 Numerical-to-Character Array Conversions 482
9.2.9 String-to-Numerical Conversions 484
9.3 The string Data Type 490
9.3.1 Creating Strings 491
9.3.2 Converting Data into Strings 491
9.3.3 Converting Strings to Other Data Types 493
9.3.4 Concatenating Strings 494
9.3.5 Comparing Strings 494
9.3.6 Searching for Substrings within a String 495
Contents | xxiii

9.3.7 Extracting Substrings from a String 496


9.3.8­ Inserting Strings into a String 497
9.3.9 Replacing Characters within a String 497
9.3.10 Erasing Characters in a String 498
9.3.11 Uppercase and Lowercase Conversion 499
9.3.12 Trimming Whitespace from Strings 499
9.4 Summary of Character Array and String Functions 499
9.5 The single Data Type 503
9.6 Integer Data Types 504
9.7 Limitations of the single and Integer Data Types 505
9.8 The datetime and duration Data Types 507
9.8.1 The datetime Data Type 507
9.8.2 The duration Data Type 508
9.8.3 calendarDuration Arrays 508
9.8.4 Time Calculations 509
9.8.5 Using Time Data in MATLAB 511
9.9 Summary 513
9.9.1 Summary of Good Programming Practice 513
9.9.2 MATLAB Summary 513
9.10 Exercises 514

Chapter 10 Sparse Arrays, Cell Arrays, Structures,


and Tables 517
10.1 Sparse Arrays 517
10.1.1 The sparse Attribute 519
10.2 Cell Arrays 525
10.2.1 Creating Cell Arrays 527
10.2.2 Using Braces {} as Cell Constructors 528
10.2.3 Viewing the Contents of Cell Arrays 528
10.2.4 Extending Cell Arrays 529
10.2.5 Deleting Cells in Arrays 531
10.2.6 Using Data in Cell Arrays 532
10.2.7 Cell Arrays of Strings 532
10.2.8 The Significance of Cell Arrays 534
10.2.9 Summary of cell Functions 538
10.3 Structure Arrays 539
10.3.1 Creating Structure Arrays 539
10.3.2 Adding Fields to Structures 542
10.3.3 Removing Fields from Structures 542
10.3.4 Using Data in Structure Arrays 543
10.3.5 The getfield and setfield Functions 544
10.3.6 Dynamic Field Names 545
10.3.7 Using the size Function with Structure Arrays 546
xxiv | Contents

10.3.8 Nesting Structure Arrays 547


10.3.9 Summary of structure Functions 548
10.4 Table Arrays 548
10.4.1 Creating Table Arrays 548
10.4.2 Accessing Data in a Table 551
10.4.3 Table Metadata (Properties) 552
10.4.4 Examining the Contents and Properties of a Table 553
10.4.5 Table Summary 554
10.5 Summary 560
10.5.1 Summary of Good Programming Practice 560
10.5.2 MATLAB Summary 561
10.6 Exercises 561

Chapter 11 Input-Output Functions 565


11.1 The textread Function 565
11.2 More about the load and save Commands 567
11.3 An Introduction to MATLAB File Processing 570
11.4 File Opening and Closing 571
11.4.1 The fopen Function 571
11.4.2 The fclose Function 574
11.5 Binary I/O Functions 575
11.5.1 The fwrite Function 575
11.5.2 The fread Function 575
11.6 Formatted I/O Functions 580
11.6.1 The fprintf Function 580
11.6.2 Understanding Format Conversion Specifiers 581
11.6.3 How Format Strings Are Used 583
11.6.4 The sprintf Function 585
11.6.5 The fscanf Function 587
11.6.6 The fgetl Function 588
11.6.7 The fgets Function 589
11.7 Comparing Formatted and Binary I/O Functions 589
11.8 File Positioning and Status Functions 594
11.8.1 The exist Function 595
11.8.2 The ferror Function 597
11.8.3 The feof Function 598
11.8.4 The ftell Function 598
11.8.5 The frewind Function 598
11.8.6 The fseek Function 598
11.9 The textscan Function 604
11.10 Function uiimport 606
11.11 Summary 609
11.11.1 Summary of Good Programming Practice 610
11.11.2 MATLAB Summary 610
11.12 Exercises 611
Contents | xxv

Chapter 12 User-Defined Classes and


Object-Oriented Programming 615
12.1 An Introduction to Object-Oriented Programming 615
12.1.1 Objects 616
12.1.2 Messages 617
12.1.3 Classes 617
12.1.4 Static Methods 618
12.1.5 Class Hierarchy and Inheritance 620
12.1.6 Object-Oriented Programming 620
12.2 The Structure of a MATLAB Class 621
12.2.1 Creating a Class 622
12.2.2 Adding Methods to a Class 624
12.2.3 Listing Class Types, Properties, and Methods 628
12.2.4 Attributes 629
12.3 Value Classes versus Handle Classes 633
12.3.1 Value Classes 634
12.3.2 Handle Classes 635
12.4 Destructors: The delete Method 638
12.5 Access Methods and Access Controls 640
12.5.1 Access Methods 640
12.5.2 Access Controls 642
12.5.3 Example: Creating a Timer Class 642
12.5.4 Notes on the MyTimer Class 647
12.6 Static Methods 648
12.7 Defining Class Methods in Separate Files 649
12.8 Overriding Operators 650
12.9 Events and Listeners 655
12.9.1 Property Events and Listeners 658
12.10 Exceptions 659
12.10.1 Creating Exceptions in Your Own Programs 660
12.10.2 Catching and Fixing Exceptions 661
12.11 Superclasses and Subclasses 662
12.11.1 Defining Superclasses and Subclasses 663
12.11.2 Example Using Superclasses and Subclasses 668
12.12 Summary 678
12.12.1 Summary of Good Programming Practice 679
12.12.2 MATLAB Summary 679
12.13 Exercises 680

Chapter 13 Handle Graphics and Animation 685


13.1 Handle Graphics 685
13.2 The MATLAB Graphics System 686
13.3 Object Handles 688
xxvi | Contents

13.4 Examining and Changing Object Properties 689


13.4.1 Changing Object Properties at Creation Time 689
13.4.2 Changing Object Properties after Creation Time 689
13.4.3 Examining and Changing Properties
Using Object Notation 690
13.4.4 Examining and Changing Properties Using
get/set Functions 692
13.4.5 Examining and Changing Properties Using
the Property Editor 694
13.5 Using set to List Possible Property Values 698
13.6 User-Defined Data 700
13.7 Finding Objects 701
13.8 Selecting Objects with the Mouse 703
13.9 Position and Units 706
13.9.1 Positions of figure Objects 706
13.9.2 Positions of axes and polaraxes Objects 707
13.9.3 Positions of text Objects 707
13.10 Printer Positions 710
13.11 Default and Factory Properties 711
13.12 Restoring Default Properties 713
13.13 Graphics Object Properties 713
13.14 Animations and Movies 714
13.14.1 Erasing and Redrawing 714
13.14.2 Creating a Movie 719
13.15 Summary 721
13.15.1 Summary of Good Programming Practice 721
13.15.2 MATLAB Summary 721
13.16 Exercises 722

Chapter 14 MATLAB Apps and Graphical User Interfaces 725


14.1 How a Graphical User Interface Works 726
14.2 Creating and Displaying a Graphical User Interface 732
14.2.1 The Structure of a Callback Function (Method) 738
14.2.2 Adding Application Data to a Figure 739
14.3 Object Properties 739
14.3.1 Key Properties of Numerical Components 741
14.3.2 Key Properties of Text Components 743
14.4 Additional Containers: Panels,Tab Groups,
and Button Groups 749
14.4.1 Panels 749
14.4.2 Tab Groups 752
14.4.3 Button Groups 752
14.5 Dialog Boxes 754
14.5.1 Alert Dialog Boxes 755
Contents | xxvii

14.5.2 Confirmation Dialog Boxes 755


14.5.3 Input Dialog Boxes 757
14.5.4 The uigetfile, uisetfile, and uigetdir Dialog
Boxes 757
14.5.5 The uisetcolor and uisetfont Dialog Boxes 759
14.6 Menus 760
14.6.1 Creating Your Own Menus 763
14.6.2 Accelerator Keys and Keyboard Mnemonics 763
14.7 Summary 774
14.7.1 Summary of Good Programming Practice 775
14.7.2 MATLAB Summary 775
14.8 Exercises 777

A UTF-8 Character Set 779

B Answers to Quizzes 781

Index 807

Chapter 15 Guide-Based Graphical User Interfaces (On-line Only)


15.1 How a Graphical User Interface Works
15.2 Creating and Displaying a Graphical User Interface
15.2.1 A Look Under the Hood
15.2.2 The Structure of a Callback Subfunction
15.2.3 Adding Application Data to a Figure
15.2.4 A Few Useful Functions
15.3 Object Properties
15.4 Graphical User Interface Components
15.4.1 Static Text Fields
15.4.2 Edit Boxes
15.4.3 Pushbuttons
15.4.4 Toggle Buttons
15.4.5 Checkboxes and Radio Buttons
15.4.6 Popup Menus
15.4.7 List Boxes
15.4.8 Sliders
15.4.9 Tables
15.5 Additional Containers: Panels and Button Groups
15.5.1 Panels
15.5.2 Button Groups
15.6 Dialog Boxes
15.6.1 Error and Warning Dialog Boxes
15.6.2 Input Dialog Boxes
xxviii | Contents

15.6.3 The uigetfile, uisetfile, and uigetdir Dialog Boxes


15.6.4 The uisetcolor and uisetfont Dialog Boxes
15.7 Menus
15.7.1 Suppressing the Default Menu
15.7.2 Creating Your Own Menus
15.7.3 Accelerator Keys and Keyboard Mnemonics
15.7.4 Creating Context Menus
15.8 Tips for Creating Efficient GUIs
15.8.1 Tool Tips
15.8.2 Toolbars
15.8.3 Additional Enhancements
15.9 Summary
15.9.1 Summary of Good Programming Practice
15.9.2 MATLAB Summary
15.10 Exercises
Chapter 1
Introduction to MATLAB

MATLAB (short for MATrix LABoratory) is a special-purpose computer program


optimized to perform engineering and scientific calculations. It started life as a pro-
gram designed to perform matrix mathematics, but over the years it has grown into
a flexible computing system capable of solving essentially any technical problem.
The MATLAB program implements the MATLAB programming language and
provides a very extensive library of predefined functions to make technical pro-
gramming tasks easier and more efficient. This book introduces the MATLAB lan-
guage as it is implemented in MATLAB Version 2018A and shows how to use it to
solve typical technical problems.
MATLAB is a huge program with an incredibly rich variety of functions. Even the
basic version of MATLAB without any toolkits is much richer than other technical
programming languages. There are more than 1000 functions in the basic MATLAB
product alone, and the toolkits extend this capability with many more functions in
various specialties. Furthermore, these functions often solve very complex problems
(solving differential equations, inverting matrices, and so forth) in a single step, saving
large amounts of time. Doing the same thing in another computer language usually
involves writing complex programs yourself or buying a third-party software pack-
age (such as IMSL, the Intel® Math Kernel Library, or the NAG software libraries)
that contains the functions.
The built-in MATLAB functions are almost always better than anything that
an individual engineer could write on his or her own because many people have
worked on them, and they have been tested against many different data sets. These
functions are also robust, producing sensible results for wide ranges of input data
and gracefully handling error conditions.
This book makes no attempt to introduce users to all of MATLAB’s functions.
Instead, it teaches users the basics of how to write, debug, and optimize good MATLAB
programs, and it introduces a subset of the most important functions used to
solve common scientific and engineering problems. Just as importantly, it teaches

1
2 | Chapter 1 Introduction to MATLAB

the scientist or engineer how to use MATLAB’s own tools to locate the right
function for a specific purpose from the enormous variety of choices available.
In addition, it teaches how to use MATLAB to solve many practical engineering
problems, such as vector and matrix algebra, curve fitting, differential equations,
and data plotting.
The MATLAB program is a combination of a procedural programming language, an
integrated development environment (IDE) that includes an editor and debugger, and
an extremely rich set of functions that perform many types of technical calculations.
The MATLAB language is a procedural programming language, meaning that the
engineer writes procedures, which are effectively mathematical recipes for solving a
problem. This makes MATLAB very similar to other procedural languages such as
C or Fortran. However, the extremely rich list of predefined functions and plot-
ting tools makes it superior to these other languages for many engineering analysis
applications.
In addition, the MATLAB language includes object-oriented extensions that
allow engineers to write object-oriented programs. These extensions are similar to
other object-oriented languages such as C++ or Java.

1.1 The Advantages of MATLAB


MATLAB has many advantages compared to conventional computer languages for
technical problem solving. Among them are the following:
1. Ease of Use
MATLAB is an interpreted language, like many versions of Basic. Like
Basic, it is very easy to use. The program can be used as a scratch pad to
evaluate expressions typed at the command line, or it can be used to exe-
cute large prewritten programs. Programs may be easily written and modified
with the built-in integrated development environment and debugged with the
MATLAB debugger. Because the language is so easy to use, it is ideal for the
rapid prototyping of new programs.
Many program development tools are provided to make the program
easy to use. They include an integrated editor/debugger, on-line documenta-
tion and manuals, a workspace browser, and extensive demos.
2. Platform Independence
MATLAB is supported on many different computer systems and thus enables
a large measure of platform independence. At the time of this writing, the
language is supported on Windows 7/8.1/10, Linux, and the Apple Mac oper-
ating system. Programs written on any platform will run on all of the other
platforms, and data files written on any platform may be read transparently
on any other platform. As a result, programs written in MATLAB can migrate
to new platforms when the needs of the user change.
3. Predefined Functions
MATLAB comes complete with an extensive library of predefined functions
that provide tested and prepackaged solutions to many basic technical tasks.
For example, suppose that you are writing a program that must calculate the
1.2 Disadvantages of MATLAB | 3

statistics associated with an input data set. In most languages, you would
need to write your own subroutines or functions to implement calculations
such as the arithmetic mean, standard deviation, median, and so forth. These
and hundreds of other functions are built right into the MATLAB language,
making your job much easier.
In addition to the large library of functions built into the basic MATLAB
language, there are many special-purpose toolboxes available to help solve
complex problems in specific areas. For example, you can buy standard tool-
boxes to solve problems in signal processing, control systems, communica-
tions, image processing, and neural networks, among many others. There is
also an extensive collection of free user-contributed MATLAB programs that
are shared through the MATLAB website.
4. Device-Independent Plotting
Unlike most other computer languages, MATLAB has many integral plot-
ting and imaging commands. The plots and images can be displayed on any
graphical output device supported by the computer on which MATLAB is
running. This capability makes MATLAB an outstanding tool for visualizing
technical data.
5. Graphical User Interface
MATLAB includes tools that allow an engineer to interactively construct a
graphical user interface (GUI) for his or her program, and also to produce
Web apps. With this capability, an engineer can design sophisticated data
analysis programs that can be operated by relatively inexperienced users.
6. MATLAB Compilers
MATLAB’s flexibility and platform independence is achieved by compiling
MATLAB programs into a device-independent p-code, and then interpreting
the p-code instructions at run-time. This approach is similar to that used by
Microsoft’s Visual Basic language or by Java. Unfortunately, the resulting
programs sometimes executed slowly because the MATLAB code is inter-
preted rather than compiled. Newer versions of MATLAB have partially
overcome this problem by introducing just-in-time (JIT) compiler technol-
ogy. The JIT compiler compiles portions of the MATLAB code as it is exe-
cuted to increase overall speed.
A separate MATLAB Coder is also available. The MATLAB Coder gen-
erates portable and readable C and C++ code from MATLAB code. This
converted code can then be compiled and included in programs written in
other languages. In addition, legacy code written in other languages can be
compiled and used within MATLAB.

1.2 Disadvantages of MATLAB


MATLAB has two principal disadvantages. The first is that it is an interpreted lan-
guage and therefore can execute more slowly than compiled languages. This problem
can be mitigated by properly structuring the MATLAB program to maximize the
performance of vectorized code and by using the JIT compiler.
4 | Chapter 1 Introduction to MATLAB

The second disadvantage is cost: a full copy of MATLAB is 5 to 10 times more


expensive than a conventional C or Fortran compiler. This relatively high cost is
more than offset by the reduced time required for an engineer or scientist to create
a working program, so MATLAB is cost-effective for businesses. However, it is too
expensive for most individuals to consider purchasing. Fortunately, there is also an
inexpensive student edition of MATLAB, which is a great tool for students wishing
to learn the language. The student edition of MATLAB is essentially identical to the
full edition.

1.3 The MATLAB Environment


The fundamental unit of data in any MATLAB program is the array. An array
is a collection of data values organized into rows and columns and known
by a single name. Individual data values within an array can be accessed
by including the name of the array followed by subscripts in parentheses
that identify the row and column of the particular value. Even scalars are
treated as arrays by MATLAB—they are simply arrays with only one row and
one column. We will learn how to create and manipulate MATLAB arrays in
Section 1.4.
When MATLAB executes, it can display several types of windows that accept
commands or display information. The three most important types of windows are
Command Windows, where commands may be entered; Figure Windows, which dis-
play plots and graphs; and Edit Windows, which permit a user to create and modify
MATLAB programs. We will see examples of all three types of windows in this
section.
In addition, MATLAB can display other windows that provide help and that
allow the user to examine the values of variables defined in memory. We will exam-
ine some of these additional windows here, and examine the others when we discuss
how to debug MATLAB programs.

1.3.1 The MATLAB Desktop


When you start MATLAB Version 2018A, a special window called the MATLAB
desktop appears. The desktop is a window that contains other windows showing
MATLAB data, plus toolbars and a “Toolstrip” or “Ribbon Bar” similar to that used
by Windows 10 or Microsoft Office. By default, most MATLAB tools are “docked”
to the desktop, so that they appear inside the desktop window. However, the user can
choose to “undock” any or all tools, making them appear in windows separate from
the desktop.
The default configuration of the MATLAB desktop is shown in Figure 1.1.
It integrates many tools for managing files, variables, and applications within the
MATLAB environment.
1.3 The MATLAB Environment | 5

Current Folder
This control allow
Browser
a user to view Launch the MATLAB
shows a list
or change the Help Browser Editor
of the files in the
current directory
current directory

Details Window
displays the Workspace Browser
MATLAB Command
properties of a file shows variables defined
Window
selected in the in workspace
Current Folder Browser

Figure 1.1 The default MATLAB desktop. The exact appearance of the
desktop may differ slightly on different types of computers.

The major tools within or accessible from the MATLAB desktop are:
■■ The Command Window
■■ The Toolstrip
■■ The Documents Window, including the Editor/Debugger and Array Editor

■■ Figure Windows

■■ The Workspace Browser

■■ The Current Folder Browser, with the Details Window

■■ The Help Browser

■■ The Path Browser

■■ A Popup Command History Window


6 | Chapter 1 Introduction to MATLAB

Table 1.1: Tools and Windows Included in the MATLAB


Desktop
Tool Description
Command Window A window where the user can type commands and see immediate
results, or where the user can execute scripts or functions
Toolstrip A strip across the top of the desktop containing icons to select func-
tions and tools, arranged in tabs and sections of related functions
Command History A window that displays recently used commands, accessed by click-
Window ing the up arrow when typing in the Command Window
Document Window A window that displays MATLAB files and allows the user to edit or
debug them
Figure Window A window that displays a MATLAB plot
Workspace Browser A window that displays the names and values of variables stored in
the MATLAB workspace
Current Folder A window that displays the names of files in the current directory. If
Browser a file is selected in the Current Folder Browser, details about the file
will appear in the Details Window
Help Browser A tool to get help for MATLAB functions, accessed by clicking the
“Help” button on the Toolstrip
Path Browser A tool to display the MATLAB search path, accessed by clicking the
“Set Path” button on the Home tab of the Toolstrip

The functions of these tools are summarized in Table 1.1. We will discuss them in
later sections of this chapter.

1.3.2 The Command Window


The bottom center of the default MATLAB desktop contains the Command
Window. A user can enter interactive commands at the command prompt (») in the
Command Window, and they will be executed on the spot.
As an example of a simple interactive calculation, suppose that you wanted to cal-
culate the area of a circle with a radius of 2.5 m. The equation for this area of a circle is
A 5 r 2 (1.1)
where r is the radius of the circle and A is the area of the circle. This equation can be
evaluated in the MATLAB Command Window by typing:
» area = pi * 2.5^2
area =
19.6350
where * is the multiplication symbol and ^ is the exponential symbol. MATLAB
calculates the answer as soon as the Enter key is pressed, and stores the answer
in a variable (really a 1 3 1 array) called area. The contents of the variable are
1.3 The MATLAB Environment | 7

Result is added
to the workspace

User input

Result of
calculation

Figure 1.2 The Command Window appears in the center of the desktop.
You enter commands and see responses here.

displayed in the Command Window as shown in Figure 1.2, and the variable can be
used in further calculations. (Note that p is predefined in MATLAB, so we can just
use pi without first declaring it to be 3.141592 … ).
If a statement is too long to type on a single line, it may be continued on succes-
sive lines by typing an ellipsis (...) at the end of the first line and then continuing
on the next line. For example, the following two statements are identical.
x1 = 1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6
and
x1 = 1 + 1/2 + 1/3 + 1/4 ...
+ 1/5 + 1/6
Instead of typing commands directly in the Command Window, a series of com-
mands can be placed into a file, and the entire file can be executed by typing its
name in the Command Window. Such files are called script files. Script files (and
functions, which we will see later) are also known as M-files because they have a file
extension of “.m”.

1.3.3 The Toolstrip


The Toolstrip (see Figure 1.3) is a bar of tools that appears across the top of the
desktop. The controls on the Toolstrip are organized into related categories of func-
tions, first by tabs, and then by groups. For example, the tabs visible in Figure 1.3 are
8 | Chapter 1 Introduction to MATLAB

Figure 1.3 The Toolstrip, which allows you to select from a wide variety
of MATLAB tools and commands.

“Home”, “Plots”, “Apps”, “Editor”, and so forth. When one of the tabs is selected,
a series of controls grouped into sections is displayed. In the Home tab, the sections
are “File”, “Variable”, “Code”, and so forth. With practice, the logical grouping of
commands helps the user to quickly locate any desired function.
In addition, the upper-right corner of the Toolstrip contains the Quick Access
Toolbar, which is where you can customize the interface and display the most com-
monly used commands and functions at all times. To customize the functions dis-
played there, right-click on the toolbar and select the Customize option from the
popup menu.

1.3.4 The Command History Window


The Command History Window displays a list of the commands that a user has
previously entered in the Command Window. The list of commands can extend
back to previous executions of the program. Commands remain in the list until
they are deleted. To display the Command History Window, press the up arrow
key while typing in the Command Window. To reexecute any command, simply
double-click it with the left mouse button. To delete one or more commands from
the Command History Window, select the commands and right-click them with the
mouse. A popup menu will be displayed that allows the user to delete the items (see
Figure 1.4).

1.3.5 The Document Window


A Document Window (also called an Edit/Debug Window) is used to create new
M-files or to modify existing ones. An Edit/Debug Window is created automati-
cally when you create a new M-file or open an existing one. You can create a new
1.3 The MATLAB Environment | 9

Figure 1.4 The Command History Window, showing three commands


being deleted.

M-file with the “New Script” command from the “File” group on the Toolstrip
(Figure 1.5a), or by clicking the New icon and selecting Script from the popup
menu (Figure 1.5b). You can open an existing M-file file with the Open command
from the “File” section on the Toolstrip.
An Edit/Debug Window displaying a simple M-file called calc_area.m
is shown in Figure 1.5. This file calculates the area of a circle given its radius
and displays the result. By default, the Edit Window is docked to the desktop, as
shown in Figure 1.5c. The Edit Window can also be undocked from the MATLAB
desktop. In that case, it appears within a container called the Documents Window,
as shown in Figure 1.5d. We will learn how to dock and undock a window later in
this chapter.
The Edit Window is essentially a programming text editor, with the MATLAB
language’s features highlighted in different colors. Comments in an M-file file appear
in green, variables and numbers appear in black, complete character strings appear in
magenta, incomplete character strings appear in red, and language keywords appear
in blue.
After an M-file is saved, it may be executed by typing its name in the Command
Window. For the M-file in Figure 1.5, the results are:
» calc_area
The area of the circle is 19.635
The Edit Window also doubles as a debugger, as we shall see in Chapter 2.
10 | Chapter 1 Introduction to MATLAB

(a) (b)

(c)
1.3 The MATLAB Environment | 11

(d)
Figure 1.5 (a) Creating a new M-file with the “New Script” command. (b) Creating
a new M-file with the “New >> Script” selection from the Toolbar. (c) The MATLAB
Editor, docked to the MATLAB desktop. (See color insert.) (d) The MATLAB Editor,
displayed as an independent window.

1.3.6 Figure Windows


A Figure Window is used to display MATLAB graphics. A figure can be a two- or
three-dimensional plot of data, an image, or a GUI. A simple script file that calculates
and plots the function sin x is as follows:
% sin_x.m: This M-file calculates and plots the
% function sin(x) for 0 <= x <= 6.
x = 0:0.1:6
y = sin(x)
plot(x,y)
If this file is saved under the name sin_x.m, then a user can execute the file by typ-
ing “sin_x” in the Command Window. When this script file is executed, MATLAB
opens a figure window and plots the function sin x in it. The resulting plot is shown
in Figure 1.6.
12 | Chapter 1 Introduction to MATLAB

Figure 1.6 MATLAB plot of sin x versus x.

1.3.7 Docking and Undocking Windows


MATLAB windows such as the Command Window, the Edit/Debugging Window, and
Figure Windows can either be docked to the desktop, or they can be undocked. When
a window is docked, it appears as a pane within the MATLAB desktop. When it is
undocked, it appears as an independent window on the computer screen separate from
the desktop. When a window is docked to the desktop, it can be undocked by selecting
the small down arrow in the upper-right corner and selecting the “Undock” option
from the popup menu (see Figure 1.7a). When a window is an independent window,
it can be docked to the desktop by selecting the small down arrow in the upper-right
corner and selecting the “Dock” option from the popup menu (see Figure 1.7b).

1.3.8 The MATLAB Workspace


A statement like
z = 10
creates a variable named z, stores the value 10 in it, and saves it in a part of computer
memory known as the workspace. A workspace is the collection of all the variables
and arrays that can be used by MATLAB when a particular command, M-file, or
function is executing. All commands executed in the Command Window (and all
1.3 The MATLAB Environment | 13

(a)

(b)

Figure 1.7 (a) Selecting the “Undock” option from the menu displayed after clicking the
small down arrow in the upper-right corner of a pane. (b) Selecting the “Dock” option
after clicking the small down arrow in the upper-right corner of an undocked window.

script files executed from the Command Window) share a common workspace, so
they can all share variables. As we will see later, MATLAB functions differ from
script files in that each function has its own separate workspace.
A list of the variables and arrays in the current workspace can be generated with
the whos command. For example, after M-files calc_area and sin_x are exe-
cuted, the workspace contains the following variables.
»     whos
Name Size Bytes Class Attributes

area 1x1 8 double


radius 1x1 8 double
string 1x32 64 char
x 1x61 488 double
y 1x61 488 double
14 | Chapter 1 Introduction to MATLAB

Script file calc_area created variables area, radius, and string, while
script file sin_x created variables x and y. Note that all of the variables are in the
same workspace, so if two script files are executed in succession, the second script
file can use variables created by the first script file.
The contents of any variable or array may be determined by typing the appro-
priate name in the Command Window. For example, the contents of string can be
found as follows:

» string
string =
The area of the circle is 19.635

A variable can be deleted from the workspace with the clear command. The
clear command takes the form

clear var1 var2 ...

where var1 and var2 are the names of the variables to be deleted. The com-
mand clear variables or simply clear deletes all variables from the current
workspace.

1.3.9 The Workspace Browser


The contents of the current workspace can also be examined with a GUI-based
Workspace Browser. The Workspace Browser appears by default in the right side
of the desktop. It provides a graphic display of the same information as the whos
command, and it also shows the actual contents of each array if the information is
short enough to fit within the display area. The Workspace Browser is dynamically
updated whenever the contents of the workspace change.
A typical Workspace Browser window is shown in Figure 1.8. As you can see, it
displays the same information as the whos command. Double-clicking on any vari-
able in the window will bring up the Array Editor, which allows the user to modify
the information stored in the variable.
One or more variables may be deleted from the workspace by selecting them in
the Workspace Browser with the mouse and pressing the delete key, or by right-click-
ing with the mouse and selecting the delete option.

1.3.10 The Current Folder Browser


The Current Folder Browser is displayed on the upper-left side of the desktop. It
shows all the files in the currently selected folder, and allows the user to edit or exe-
cute any desired file. You can double-click on any M-file to open it in the MATLAB
editor, or you can right-click it and select “Run” to execute it. The Current Folder
Browser is shown in Figure 1.9. A toolbar above the browser is used to select the
current folder to display.
1.3 The MATLAB Environment | 15

Array Editor allows the Workspace Browser


user to edit any variable shows a list of the
or array selected in the variables defined
Workspace Browser in the workspace

Figure 1.8 The Workspace Browser and Array Editor. The Array Editor
is invoked by double-clicking a variable in the Workspace Browser. It allows
you to change the values contained in a variable or array.

1.3.11 Getting Help


There are three ways to get help in MATLAB. The preferred method is to use the
Help Browser. The Help Browser can be started by selecting the icon from the
Toolstrip or by typing doc or helpwin in the Command Window. A user can get
help by browsing the MATLAB documentation, or he or she can search for the details
of a particular command. The Help Browser is shown in Figure 1.10.
There are also two command-line-oriented ways to get help. The first way is to
type help or help followed by a function name in the Command Window. If you
just type help, MATLAB will display a list of possible help topics in the Command
Window. If a specific function or a toolbox name is included, help will be provided
for that particular function or toolbox.
The second way to get help is the lookfor command. The lookfor com-
mand differs from the help command in that the help command searches for
an exact function name match, while the lookfor command searches the quick
summary information in each function for a match. This makes lookfor slower
than help, but it improves the chances of getting back useful information. For
example, suppose that you were looking for a function to take the inverse of a
matrix. Since MATLAB does not have a function named inverse, the command
16 | Chapter 1 Introduction to MATLAB

Selecting the
current folder

Current Folder
Browser

Figure 1.9 The Current Folder Browser.

“help inverse” will produce nothing. On the other hand, the command “look-
for inverse” will produce the following results:
» lookfor inverse
ifft - Inverse discrete Fourier transform.
ifft2      - Two-dimensional inverse discrete Fourier transform.
ifftn - N-dimensional inverse discrete Fourier transform.
ifftshift - Inverse FFT shift.
acos - Inverse cosine, result in radians.
acosd - Inverse cosine, result in degrees.
acosh - Inverse hyperbolic cosine.
acot - Inverse cotangent, result in radian.
acotd - Inverse cotangent, result in degrees.
acoth - Inverse hyperbolic cotangent.
1.3 The MATLAB Environment | 17

acsc - Inverse cosecant, result in radian.


acscd - Inverse cosecant, result in degrees.
acsch - Inverse hyperbolic cosecant.
asec - Inverse secant, result in radians.
asecd - Inverse secant, result in degrees.
asech - Inverse hyperbolic secant.
asin - Inverse sine, result in radians.
asind - Inverse sine, result in degrees.
asinh - Inverse hyperbolic sine.
atan - Inverse tangent, result in radians.
atan2 - Four quadrant inverse tangent.
atan2d - Four quadrant inverse tangent, result in degrees.
atand - Inverse tangent, result in degrees.
atanh - Inverse hyperbolic tangent.
invhilb - Inverse Hilbert matrix.
ipermute - Inverse permute array dimensions.
dramadah - Matrix of zeros and ones with large determinant
or inverse.
invhess - Inverse of an upper Hessenberg matrix.
inv - Matrix inverse.
pinv - Pseudoinverse.
...
From this list, we can see that the function of interest is named inv.

Figure 1.10 The Help Browser.


18 | Chapter 1 Introduction to MATLAB

1.3.12 A Few Important Commands


If you are new to MATLAB, a few demonstrations may help to give you a feel for its
capabilities. To run MATLAB’s built-in demonstrations, type demo in the Command
Window.
The contents of the Command Window can be cleared at any time using the clc
command, and the contents of the current Figure Window can be cleared at any time
using the clf command. The variables in the workspace can be cleared with the
clear command. As we have seen, the contents of the workspace persist between
the executions of separate commands and M-files, so it is possible for the results of
one problem to have an effect on the next one that you may attempt to solve. To avoid
this possibility, it is a good idea to issue the clear command at the start of each new
independent calculation.
Another important command is the abort command. If an M-file appears to
be running for too long, it may contain an infinite loop, and it will never terminate.
In this case, the user can regain control by typing control-c (abbreviated ^c) in the
Command Window. This command is entered by holding down the control key while
typing a “c”. When MATLAB detects a ^c, it interrupts the running program and
returns a command prompt.
There is also an auto-complete feature in MATLAB. If a user starts to type a
command and then presses the Tab key, a popup list of recently typed commands
and MATLAB functions that match the string will be displayed (see Figure 1.11).
The user can complete the command by selecting one of the items from the list.

Figure 1.11 If you type a partial command and then hit the Tab key, MATLAB will
pop up a window of suggested commands or functions that match the string.
1.3 The MATLAB Environment | 19

The exclamation point (!) is another important special character. Its special
purpose is to send a command to the computer’s operating system. Any characters
after the exclamation point will be sent to the operating system and executed as
though they had been typed at the operating system’s command prompt. This fea-
ture lets you embed operating system commands directly into MATLAB programs.
Finally, it is possible to keep track of everything done during a MATLAB ses-
sion with the diary command. The form of this command is
diary filename
After this command is typed, a copy of all input and most output typed in the Com-
mand Window is echoed in the diary file. This is a great tool for re-creating events
when something goes wrong during a MATLAB session. The command “diary
off” suspends input into the diary file, and the command “diary on” resumes
input again.

1.3.13 The MATLAB Search Path


MATLAB has a search path that it uses to find M-files. MATLAB’s M-files are orga-
nized in directories on your file system. Many of these directories of M-files are pro-
vided along with MATLAB, and users may add others. If a user enters a name at the
MATLAB prompt, the MATLAB interpreter attempts to find the name as follows:
1. It looks for the name as a variable. If it is a variable, MATLAB displays the
current contents of the variable.
2. It checks to see if the name is an M-file in the current directory. If it is,
MATLAB executes that function or command.
3. It checks to see if the name is an M-file in any directory in the search path.
If it is, MATLAB executes that function or command.
Note that MATLAB checks for variable names first, so if you define a variable
with the same name as a MATLAB function or command, that function or command
becomes inaccessible. This is a common mistake made by novice users.

Programming Pitfalls
Never use a variable with the same name as a MATLAB function or command. If you
do so, that function or command will become inaccessible.

Also, if there is more than one function or command with the same name, the
first one found on the search path will be executed, and all of the others will be
inaccessible. This is a common problem for novice users, as they sometimes create
M-files with the same names as standard MATLAB functions, making the standard
functions inaccessible.
20 | Chapter 1 Introduction to MATLAB

Programming Pitfalls
Never create an M-file with the same name as a MATLAB function or command.

MATLAB includes a special command (which) to help you find out just
which version of a file is being executed and where it is located. This can be
useful in finding filename conflicts. The format of this command is which
functionname, where functionname is the name of the function that you
are trying to locate. For example, the cross-product function cross.m can be
located as follows:
» which cross
C:\Program
Files\MATLAB\R2018a\toolbox\matlab\specfun\cross.m
The MATLAB search path can be examined and modified at any time by
selecting the “Set Path” tool from the Environment section of the Home tab on
the Toolstrip, or by typing pathtool in the Command Window. The Path Tool is
shown in Figure 1.12. It allows you to add, delete, or change the order of directories
in the path.

Figure 1.12 The Path Tool.


1.4 Using MATLAB as a Calculator | 21

Other path-related functions include the following:


■■ addpath Add directory to MATLAB search path.
■■ path Display MATLAB search path.
■■ savepath Save the entire current MATLAB path to pathdef.m.
■■ rmpath Remove directory from MATLAB search path.

1.4 Using MATLAB as a Calculator


In its simplest form, MATLAB can be used as a calculator to perform mathematical
calculations. The calculations to be performed are typed directly into the Command
Window, using the symbols +, -, *, /, and ^ for addition, subtraction, multiplication,
division, and exponentiation, respectively. After an expression is typed, the results of
the expression will be automatically calculated and displayed. If an equal sign is used
in the expression, then the result of the calculation is saved in the variable name to
the left of the equal sign.
For example, suppose that we would like to calculate the volume of a cylinder
of radius r and length l. The area of the circle at the base of the cylinder is given by
the equation

A 5 r2 (1.2)

and the total volume of the cylinder will be

V 5 Al (1.3)

If the radius of the cylinder is 0.1 m and the length is 0.5 m, then the volume of
the cylinder can be found using the following MATLAB statements (user inputs are
shown in boldface):
» A = pi * 0.1^2
A =
0.0314
» V = A * 0.5
V =
0.0157
Note that pi is predefined to be the value 3.141592 … .
When the first expression is typed, the area at the base of the cylinder is calcu-
lated, stored in variable A, and displayed to the user. When the second expression is
typed, the volume of the cylinder is calculated, stored in variable V, and displayed
to the user. Note that the value stored in A was saved by MATLAB and reused when
we calculated V.
If an expression without an equal sign is typed into the Command Window,
MATLAB will evaluate it, store the result in a special variable called ans, and
display the result.
Discovering Diverse Content Through
Random Scribd Documents
Chester

As a rule, design did not originate with the wood carver; it first
found expression in stone. And it well may be that to earlier work
executed in stone rather than to the stallwork of Ely the Lincoln
design is to be attributed. At any rate, the tabernacled canopies of
wood are anticipated in most marked fashion in the monument of
Archbishop Stratford in Canterbury cathedral. He died in 1348; his
monument is therefore earlier than any of the tabernacled canopies
in wood. It consists of two stories, with three gables below and a
single niche above; then come spirelets with pinnacles between.[24]
There is a similar monument to Archbishop Kemp, who died in 1454.
Of the Lincoln work Mr A. W. Pugin said that "the stalls are executed
in the most perfect manner, not only as regards variety and beauty
of ornamental design, but in accuracy of workmanship, which is
frequently deficient in ancient examples of woodwork.... They are
certainly superior to any other choir fittings of that period remaining
in England. The misericords also are all varied in design, and consist
of foliage, animals, figures and even historical subjects, beautifully
designed, and executed with surpassing skill and freedom." As the
work was begun by the treasurer, John of Welbourn, who died in
1380, we may give it the approximate date of 1370. This is borne
out by the fact that on the base of the Dean's stall are the bearings
of Dean Stretchley, who died in 1376.[25]

Judging from the armour represented on the misericords the design


of the Lincoln stalls was copied very soon afterwards, say c. 1390, in
Chester cathedral, but with a magnificence of foliated ornament
which is reminiscent of the glorious stalls of Lancaster. For the main
lines of the design, however, the new type of canopy which had
been worked out at Lincoln was taken as a model; the details only
are those of Lancaster, the general design is from Lincoln. As at
Lincoln, the lower canopy has duplicated gables in front of each of
the three faces of the main structure of the canopy. This main
structure starts from between pinnacled buttresses, as it were,
separating each canopy; then is brought forward like an oriel
window, having square-headed traceried windows, the whole
surmounted by a battlemented pierced parapet. In front of each face
of the oriel is first a truncated ogee arch, and second, a complete
ogee arch, both springing from a battlemented and pinnacled corner
buttress. These buttresses, whether between the canopies or in
front of the corners of the oriels, are truncated, the former rising not
from the shoulders of the stalls below but from angels, the latter
from carved bosses or paterae. The gables at the back spring from a
higher level than those in front, and, as at Lincoln, are truncated
ogee arches. The three front gables are complete ogee arches,
which differ from those in the Lincoln stallwork in that their lower
convex curve spreads outward again. This is an important matter;
for though this compound ogee arch is not employed in the Lincoln
stalls, yet it occurs up and down the cathedral in the stonework of
the fourteenth century; e.g., in the arcading under the western
towers[26] put up by the same treasurer who paid for the stalls. It is
so special and characteristic to Lincoln that its presence at Chester
may be taken as a decisive proof of Lincoln influence in the design of
the stalls. In the upper story is a central niche, flanked by window
tracery, as at Lincoln. Above rises a lofty spirelet, encircled at its
base by "Lincoln ogee" gables. Between the spirelets, as at Ely and
Lincoln, are tall pinnacles. The leafage of the lower canopies should
be compared with that of Lancaster. In the five examples illustrated
(53, 55, 56) it will be seen how consummate and versatile in design
were these mediæval craftsmen; they were bubbling over with
design, and could not repeat themselves if they wished.[27]
Chester Chester

Chester Chester

Nantwich Nantwich

The magnificent church of Nantwich, Cheshire, was in building


before the Black Death of 1349; the work was then stopped; and
when it was resumed, it was carried out in a different style. To this
later period belong the south transept and the east window of the
chancel with rectilinear tracery; it is probable that the pulpit and
stalls also belong to this second work, c. 1400. The design connects
itself with that of the Lincoln and Chester stalls in the absence of
any line of demarcation between the upper and lower portions; but
while that of Chester is reminiscent of early fourteenth century work,
that of Nantwich is well advanced toward normal fifteenth century
design. It is also much richer than either, the lower stage being a
mass of niches and pinnacles, with angel corbels below. The great
novelty at Nantwich is the absence of spirelets, the absence of which
is nobly compensated for by the increased height and prominence
given to the central of the three upper niches (57).

York
Minster

The stalls of York Minster were destroyed by fire in 1819. Both in the
treatment of the supporting shafts and in the design of the single
upper niches flanked by window tracery they closely resembled the
Lincoln stalls, on which they were probably modelled; above the
upper niches rose spirelets flanked by pinnacles. There is a marked
horizontal line midway, dividing the composition into two stories
(58). The presbytery of York Minster was built between 1361 and
1370; the choir between 1380 and 1400; we may therefore take
1390 as the approximate date of the stalls. They are a little later
than the Lincoln stalls, and probably contemporaneous with those of
Chester. A general view of the stalls appears in Drake's Eboracum,
page 522 (18).

Carlisle

At Carlisle the stalls were erected by Bishop Strickland (1399-1413);


Prior Haithwaite is said to have added the tabernacle work after the
year 1433:[28] it would therefore be about forty years later than that
at Chester (21). The lower canopy, as before, has triple gables,
which are truncated ogees, but the additional front gable of Lincoln
and Chester is omitted, while the pinnacled buttresses separating
the canopies are carried by shafts standing on the shoulders of the
stalls. The line of demarcation between the two stories, which the
Lincoln and Nantwich designs had minimised, is now emphasised by
making the band of quatrefoils continuous. The upper story, which in
the earlier designs had had insufficient dominance, is now
heightened and enlarged; it consists of three pedestalled niches
instead of one; and the flanking window tracery of Lincoln and
Chester, with its makeshift look, is reduced in importance, forming
merely the backing of the three upper niches. The spirelet above is
also greatly enriched, and additional pinnacles are introduced. A little
prim the design may be in comparison with the exuberance of
Lincoln, Chester and Nantwich, but the proportions are fine, and
were the statuettes once more in their niches, it would be a very
satisfactory composition. Such work as this has well been resembled
to "a whole wood, or say a thicket of old hawthorn with its topmost
branches spared, slowly growing into stalls."

Ripon

At St Asaph's cathedral the stalls and part of the canopies are


ancient.[29] The cathedral was gutted by fire in 1402, and the stalls
were not re-erected till 1471-1495.

Fifty years later than the Carlisle stalls were put up those of Ripon
Minster (60). As two of the misericords are inscribed 1489 and 1494,
they cannot be earlier than the latter year. Just as the Chester stalls
were a criticism of those of Lincoln, and the Lincoln stalls of those of
Ely, so the stalls of Ripon are a criticism of those of Nantwich and
Carlisle. In the latter the upper story had been emphasised; at Ripon
the bottom story is given the dominance; compared with the
simplicity of the Carlisle design, the lower stage at Ripon, as at
Nantwich, is surpassingly rich; gables and pinnacles and window
tracery are loaded with beautiful detail, cusped arches are added
below; finally figure sculpture is called in, and capitals and corbels
are beset with tiny angels. In the string-course between the two
stories quatrefoils are abandoned; it is molded, foliated and
battlemented. In the upper story reappears the forest of pinnacles of
Carlisle and the window tracery of Lincoln. Here, as elsewhere, the
design suffers grievously from the loss of the statuettes which once
ranged continuously in the upper story.

Manchester

Beverley Minster
Some twenty years later, stallwork was put up in the collegiate
church of Manchester. On the north side of the choir is a curious
shield with the initials of Richard Beck, a Manchester merchant, by
whom all the stalls on that side were erected: the southern stalls
were erected by Bishop Stanley, and at the west end of them is the
shield of Stanley with the Stanley legend of the eagle and child. At
Manchester craftsman ambition had to surpass Ripon and Nantwich.
But the lower stages of Nantwich and Ripon were unsurpassable; so
they were copied, angelettes included. The string-course is
strengthened and improved by additional battlements; but undue
emphasis is prevented by making it discontinuous. In the upper
story, by way of change, there is a reversion to the single niche,
flanked by window tracery, of Lincoln and Chester; finally, originality
is asserted by surmounting the whole, in somewhat doubtful
propriety, with a continuous tester, so that the canopies that cover
the stalls are themselves covered and protected. This tester has a
horizontal cornice with brattishing above and cornice braces between
pendant pieces below. To make room for this the spirelets so much
in vogue are replaced, as at Nantwich, by canopies with horizontal
cresting—taking it altogether, a magnificent design, if only the Ripon
stalls had not existed (62).

Beverley Beverley
Minster Minster
Beverley Beverley
Minster Minster

Then come the stalls of Beverley Minster, misericords of which are


inscribed with the dates 1520 and 1524; the stalls are therefore
about a dozen years later than those of Manchester. They are
modelled closely on those of Manchester and Ripon. It is quite
conceivable that some of the carvers may have worked successively
at Ripon (1500), Manchester (1508) and Beverley (1520). As at
Ripon, the lower story is made predominant, the little angels being
replaced, however, by human busts—no great improvement; not that
they are not full of life and interest (27, 63). The string-course is
that of Manchester. The upper story has single niches flanked by
window tracery, as at Manchester. The horizontal canopy of
Manchester now remains over the return stalls only. On the whole it
must be admitted that these stalls mark no advance. A bit of original
design indeed appears at one point, where low, heavy straight-lined
gables are introduced quite out of harmony with the curving ogee
arches (64).
Durham

Then comes the Dissolution; a long list of Tudor monarchs reign and
pass away; Stuarts take their place; Civil War follows; at length at
the Restoration of 1660 the Church comes to her own again, and
John Cosin ascends the episcopal throne of Durham. True to the
Church of England and loyal to Gothic Architecture, he reverts to the
consecrated form, and tabernacled stalls are reared once more—one
of his many contributions to the cathedral and diocese of Durham
(22). Nor is the design an unworthy one; nay, rather it is a distinct
improvement on that of Carlisle, Ripon, Manchester and Beverley;
for by abolishing the string-course, he reduces the design to the
unity with which it started at Lincoln. Moreover, tall pinnacles had
flanked the spirelets of Ely, Lincoln, Chester, Carlisle, Ripon and
Beverley, so that really one could not see the wood for the trees;
these pinnacles are now omitted, and the spirelets get their full
value. Altogether a very fine design; and the little bits of
Renaissance detail which here and there creep in, as in the bishop's
magnificent font cover,[30] only add to its charm (66). Other
examples of John Cosin's time are to be seen at Brancepeth where
he was formerly rector from 1626 to 1633; the stalls, screens and
pulpit of that church are simply delightful (93). More of this work is
to be seen in the chapel of the Bishop's palace at Bishop's Auckland;
in the church of his son-in-law at Sedgefield and at Sherburn
hospital. So Gothic in spirit is this work that it has been again and
again ascribed to Elizabethan times, e.g., by Billings in his County of
Durham. In spite of the coarseness of some of the detail and that
here and there a bit of Classical detail creeps in, it is most
interesting and enjoyable; would that we had more of these
delightful admixtures of Classic and Gothic forms; plentiful in Spain
and France, they are rare with us.

Dunblane

The stalls in Dunblane cathedral are thought by Messrs Macgibbon


and Ross[31] to have been put up in the time of Bishop James
Chisholm (1486-1534). In that case they would be c. 1520. "The
work is rather rough in execution, not to be compared with the more
characteristic woodwork of King's College, Aberdeen"; nevertheless it
is very picturesque and interesting. The introduction of the centaurs
indicates Renaissance influence; the foliage carving is a rather
curious mixture of late Gothic and Classic forms, such as we find
elsewhere in Scottish carved work of this period. The Scottish thistle
is one of the chief motifs (67).

In the chapel of King's College, Aberdeen, is a considerable amount


of fine oak carved work, by far the most extensive and best of its
kind in Scotland. The chapel itself, in some of its features, bears the
character of the parish church at Stirling and other Scottish works of
the beginning of the sixteenth century. The carved stalls,
monuments, and decorative work of the interior are of the same
period, but may possibly have been brought from a distance, or
executed by foreign workmen engaged (like the English plumber) by
the bishop. The panels are all of different design, and shew a great
deal of variety combined with a sufficiently uniform effect when the
work is viewed as a whole. In some of them the details are based on
floral forms—thistle, vine, oak, &c.—while the conventional French
fleur-de-lis is also introduced.[32]

At this point arises the question how far our stallwork was influenced
by foreign design. It may be stated at once with confidence that of
the great majority of the stalls the design is as thoroughly English as
the oak of which they are built. We have seen that the flowing and
ogee forms of the Ely tracery were designed not later than 1338,
which is at least sixty years earlier than any work of the sort in
France. We were able to see how by gradual modifications of the Ely
design the craftsmen were able to advance slowly but assuredly to
the stallwork of Lincoln, Chester, Nantwich, Carlisle, Ripon,
Manchester, Beverley, Durham; the glorious chain of artistic success
is complete; every link is there. But there are facts on the other side
which, at any rate at Melrose, are beyond dispute or controversy. In
1846 a document was communicated to the Society of Antiquaries,
London, from West Flanders, relating to a dispute at Bruges between
William Carebis, a Scotch merchant, and John Crawfort, a monk of
Melrose, on the one hand, and Cornelius de Aeltre, citizen and
master of the art of carpentry of Bruges, on the other hand. The
latter had contracted to supply certain stalls and to erect them in the
abbey church of Melrose, after the fashion of the stalls of the choir
of the abbey church of Dunis in Flanders, with carving similar to that
existing in the church of Thosan near Bruges. The stipulated price
had been paid, and the master carpenter was called to account for
delaying to complete the work; whereupon he pleaded various
excuses, stating that the work had been impeded by popular
commotions at Bruges, during which he had been deserted by his
workmen and had suffered heavy losses. It was decided that
Melrose abbey should bear the cost of its transport to the town of
Sluys and embarkation there for Scotland, and should make some
allowance to Cornelius towards his journey to Melrose; and that they
should give him and his chief carver (formiscissori) a safe-conduct
for their journey and return. This document was dated 7th October,
1441.[33]

Windsor

No such wholesale example of foreign design occurs in England;


nevertheless there are two important instances in which Flemish
design is to be suspected; viz., in the Royal chapels at Windsor and
Westminster. As regards the stalls in St George's chapel, Windsor, it
is known that the tabernacled canopies were begun in 1477 and
were completed in 1483; thus they took six years to make (69).[34]
The canopies are known to have been made in London; the carvers
being Robert Ellis and John Filles, apparently Englishmen. On the
other hand the great Rood, with the statues of St George and St
Edward and others, was made by Diricke Vangrove and Giles
Vancastell, who are just as evidently Dutchmen; for four images the
two Dutchmen were paid at the rate of 5s. per foot; for six canopies
the two Englishmen received £40, say £480; i.e., about £80 of our
money for each canopy. Now here we have Dutch and English
carvers engaged together on what was practically one work:
moreover the more artistic and difficult part of the work, the figure
sculpture, is entrusted to the Dutchmen. It is to the latter probably
that the general lines of the design are due. The detail is sufficiently
English; not so the general design. For the Windsor stallwork is
intermediate between that of Chester (c. 1390) and Carlisle (1433)
on the one hand, and Ripon (c. 1490) and Manchester (1508) on the
other. But it is not a development arising out of either of the earlier
designs, nor was the stallwork of Ripon and Manchester in any way
a development from that of Windsor.
Windsor

All the larger stallwork of the fifteenth century was, as we have


seen, designed in two stories, rising into spirelets and pinnacles; at
Windsor the double story, the spirelet and the pinnacle are all alike
lacking. It is true that the original canopies were designed quite as
much for the Knights of the Garter as for the Windsor Canons, and
in the case of the former the design had to be accommodated to
provide supports for the knights' helmets, mantles and swords;
nevertheless this might have been accomplished without utterly
breaking away from current design. The Windsor design, so far as
English work goes, has no ancestry; its origin no doubt is to be
found in the Netherlands. The Windsor stalls have been much
tampered with. As Hollar's engraving in Ashmole's Institution of the
Order of the Garter (1672) shews, over the westernmost bay on
either side of the choir the canopies contained imagery and had a
horizontal cresting; and all the other canopies consisted alternately
of towers and spirelets; the knights being seated under the towers
and the canons under the spirelets; but since the enlargement of the
Order in 1786 all the spirelets have been converted into towers (71).
All these towers are surmounted by wooden busts, of which the
earliest go back to the time of Edward IV.; on the bust were placed
the knight's helmet, crest and mantlings, which hid the busts from
view; lower down, in front, hung his sword; banners were not added
till a later period. At first the real sword and helm were put up; later,
they were theatrical properties.

Bishop Langton's
Chapel

In Winchester cathedral is stallwork of rare beauty in the Lady


Chapel, which was built in the time of Bishop Courtenay, 1486-1492.
In some of its details it resembles the Windsor stalls, which were
completed in 1483; it is therefore feasible that some of the Windsor
carvers went on to Winchester (73). South of the Lady Chapel is the
chantry chapel of Bishop Langton, 1493-1500, where also the screen
and coved panelling are of great excellence (72); there are no stalls.
Winchester Westminster
Cathedral Abbey

Henry the Seventh's chapel at Westminster was built partly as a


Lady Chapel, partly to be the mausoleum of Henry VII. and his
Queen, and of Henry VI.[35] Here the canopies with tower-like form
and single story and with the absence of pinnacle are plainly
reminiscent of those of Windsor, and as plainly distinct from current
English design, as seen at Manchester in 1508 and Beverley Minster
in 1520; the Westminster and Manchester canopies were being
made together; but those of Westminster have no connection with
the grand Northern series of consecutive designs (131). Besides
Windsor influence there may be direct influence from the
Netherlands; for some of the misericords are evidently from the
design of a painter or engraver, the subjects being too crowded to
be properly carved in wood in so limited a space. Mr J. Langton
Barnard says,[36] "While looking over some engravings on copper of
Albert Durer, I came across one which strikingly resembled the third
misericord in the upper row on the north side; the resemblance was
extremely close, especially in the arrangement and folds of the
woman's dress; this is stated by Bartsch in his Catalogue (vii. 103
and 93) to be one of his earliest plates. Another plate of Albert Durer
closely resembles the corresponding misericord in the lower row on
the south side, as regards the position of the limbs and the folds of
the drapery; while the seventh misericord of the lower row on the
south side almost exactly resembles a plate by Israel van
Meckenern, of two monkeys and three young ones." These stalls
formerly occupied only the three western bays of the chapel;
another bay was filled with stalls when the Order of the Bath was
revived by King George the First; the canopy-fronts for an additional
bay on each side being got by sawing off canopy-backs and putting
them up as fronts. The tabernacle work is of the richest and most
diversified character, varying in every canopy (73).

CHAPTER V

RENAISSANCE STALLWORK

Thus far the stallwork has been wholly of Gothic design, or nearly
so. We now come to the great change of style, the reversion to the
Classic art of ancient Rome, which goes by the name of the
Renaissance. Of this the chief representatives left to us are the stalls
of Christchurch, Hants; King's College, Cambridge; and Cartmel,
Lancashire. The stalls and misericords of Christchurch, as we see
them now, are a patchwork of portions of work of several periods
framed together at some more or less recent epoch; there are at
least two styles of Renaissance work, and three or more of Gothic.
The earlier Renaissance work, which is seen in most of the
misericords and on the stall backs is that of William Eyre who was
Prior from 1502 to 1520 (2). There are fifty-eight stalls; of the
misericords twenty-six have been stolen or destroyed. The early date
of this work makes it of exceptional importance in the history of the
introduction of Renaissance art into England. One special feature of
the work is the portrait panels. These also occur in a cupboard
preserved in Louth church, Lincolnshire, where the panels have what
look very much like portraits of Henry VII. and his queen, Elizabeth
of York. It goes by the name of the "Sudbury hutch" and was the gift
of Thomas Sudbury, who was vicar from 1461 to 1504: it is therefore
of the time of Henry VII. These "portrait cabinets" had a great vogue
in the reign of Henry VIII., and throughout the sixteenth century.
Then come three important tombs by Torrigiano, executed between
1509 and 1518, that of Henry VII. and his Queen and that of
Margaret Beaufort at Westminster and that of Dr Young in the Rolls
chapel. Almost as early, if not quite so, is Prior Eyre's work at
Christchurch. Then comes Cardinal Wolsey's work at Hampton Court,
1515 to 1525; the beautiful Marney tomb at Layer Marney, Essex,
1523; the mortuary chests in the cathedral, and the screen work
both in the cathedral and in St Cross, Winchester, c. 1525; the
chantry chapel of Prior Draper at Christchurch, 1529, and that of
Lady Salisbury, which may be a year or two earlier; and the screen
at Swine church, Yorkshire, dated 1531. Then follow Henry VIII.'s
hall at Hampton Court, 1534; and the screen at King's College,
Cambridge, 1533.
Christchurch

Christchurch

So that the Christchurch work stands very high on the list and
deserves much more attention than it has received. The general
outline of the stalls themselves is Gothic, the chief divergency being
in the supports of the elbow rests and seats. Among the shafts are
examples of the honeycomb form which is almost the only bit of
Renaissance detail in the canopies of the Westminster stalls. At the
back of the stalls are very vigorous carvings of classical dragons,
serpents, hounds and human faces (76). To these last fanciful
attributions have been made; e.g., one has been imagined to
represent Catharine of Arragon between Cardinal Wolsey and
Cardinal Campeggio (77). These portrait busts have a wide
distribution; they occur in wood, stone and terra cotta. Noble
examples are those in terra cotta at Hampton Court, which were
undoubtedly imported by Cardinal Wolsey direct from Italy.[37]
Others no doubt are the work of Italians resident in England in the
first half of the sixteenth century, when Italian art and Italian
literature were equally the fashion with the cognoscenti led by Henry
VIII. and Wolsey; e.g., the fine bust of Sir Thomas Lovell by
Torrigiano, now in Westminster Abbey.[38] These portrait busts have
a wide range—from Essex westward to Somerset, Devon and
Cornwall; e.g., North Cadbury, Somerset; Lapford, Devon, and
Talland, Cornwall; several also occur at Hemingborough, Yorkshire.
The probability is that the Italian artists entered the kingdom at
Southampton; and that a few found work at Christchurch and in the
south-west, but that the main body proceeded eastward to
Winchester, Basing, London and Layer Marney; they have left one
memorial at Oxford beneath a window at Christ Church.[39]

King's College, Cambridge


Next come the famous screen and stalls of King's College,
Cambridge—"the finest woodwork this side of the Alps." Harmonious
as is the general effect of the stallwork, it was executed at three
different periods. The stalls were ordered to be made by Henry VI. in
his will, but were not put up till much later. About 1515 an estimate
was obtained for 130 stalls, which it was found would cost about
£12,000 of our money, i.e., about £92 each. On the screen, which is
part of the same work, are the arms, badge and initials of Anne
Boleyn, who was at the height of her influence between 1531 and
1535; the stallwork may be ascribed to the same period, but as yet
the stalls had plain backs. In 1633 Mr Thomas Weaver presented the
large coats of arms which are seen on the backs of the stalls (78).
The cresting was made between 1675 and 1678 by Thomas Austin,
following more or less the style of the work below.[40] The screen is
more completely Italian in treatment than any other work of the
time, all the moldings being Classic; it is practically certain that the
general design and most of the work must have been done by
Italians. The design of screen and stalls alike is to be regarded as an
isolated example, complete in itself. It did not grow out of anything
that went before it in England, nor did it develop into anything else
in England afterwards.[41]

More Classical still in design—an entablature with architrave, frieze


and cornice superseding the semicircular arches of the Cambridge
stalls—is the superb woodwork at Cartmel, Lancashire. From the
Dissolution up to 1620, the choir of Cartmel priory church was
roofless; the canopies of the stalls must have perished; the stalls
themselves remain, bearing the mark of long exposure to the
weather. In 1620 it is recorded[42] that George Preston of Holker,
who died in 1640, not only reroofed the chancel, "but decorated the
quire and chancel with a profusion of curiously and elaborately
carved woodwork" (80).
Cartmel

Cartmel

Cartmel was a priory church of Austin Priors, with an income at the


Dissolution of £90, say £1,000. There are twenty-six stalls; above
the doorways are inscriptions in gold letters from the Psalms. The
architrave is supported by shafts which have Corinthian capitals,
round which cling in delightful fashion delicate tendrils and fruit of
the vine. On the shafts also are emblems of the Passion; in the
illustrations may be recognised the cross, the ladder, the buffet, the
pillar of scourging, the hammer and the nails. At the back is delicate
tracery work, reminding one of the Gothic tracery of the screen of St
Catharine's chapel in Carlisle cathedral. The whole design is full of
grace and charm; above all in the delicate tendrils of the vine coiling
round the shafts; one's first thought is to class it with the exquisite
scrollwork of the churches of S. Maria dei Miracoli at Brescia and
Venice, and with the work of the Italian artists in England in the time
of Henry VIII. For as a rule, says Mr Gotch,[43] "with the close of the
first half of the sixteenth century we come to the end of pronounced
Italian detail such as pervades the tiles at Lacock abbey and
characterises other isolated features in different parts of the country.
The nature of the detail in the second half of the sixteenth century,"
and in the seventeenth century, "is different; it no longer comprises
the dainty cherubs, the elegant balusters" (cf. the King's College
stalls) "vases and candelabra, the buoyant dolphins and delicately
modelled foliage which are associated with Italian and French
Renaissance work, but indulges freely in strapwork curled and
interlaced, in fruit and foliage, in cartouches and in caryatides, half
human beings, half pedestals, such as were the delight of the
Dutchmen" who had superseded the Italian artists. In the Cartmel
stalls the one feature which is pre-eminently Jacobean is to be seen
in the character of the busts in the frieze; if they are compared with
those at Christchurch (77), they are seen at once to be of
seventeenth and not of sixteenth century design. Setting those
aside, the design is purely that of the Early English Renaissance, as
practised by Italian artists. It is one of the most remarkable
examples of "survival" in design in the range of English art, and as
beautiful as it is belated—a whole century behind the times.
St Paul's Cathedral

In 1697 the choir of St Paul's cathedral was opened for public


worship. The stalls differ considerably in type from those of Pre-
Reformation days, as it was necessary to provide seats for the Lord
Mayor and Corporation of London as well as closets at the back to
accommodate the wives and families of the canons. By the removal
of the western screen in the time of Dean Melvill, appointed 1856,
the appearance of the choir has been completely changed. The
exquisite carvings of Grinling Gibbons, says Dean Milman,[44] are not
merely admirable in themselves, but in perfect harmony with the
character of the architecture. He even goes so far as to say that they
rival, if they do not surpass, all mediæval works of their class in
grace, variety and richness; and keep up an inimitable unison of the
lines of the building and the decoration. In the words of Horace
Walpole, "there is no instance of a man before Gibbons who gave to
wood the loose and airy lightness of flowers, and changed together
the various productions of the elements with a fine disorder natural
to each species." It is doubtful whether Grinling Gibbons was of
Dutch or English birth. He was discovered by Evelyn in a poor
solitary thatched house near Sayes Court carving a Crucifixion after
Tintoretto. In this piece more than a hundred figures were
introduced; "nor was there anything in nature so tender and delicate
as the flowers and festoons about it; and yet the work was strong."
He asked Evelyn £100 for it. The frame, says Evelyn, was worth as
much. Evelyn introduced "the incomparable young man" to the King
and to Wren, and his fortune was made. Malcolm in his Londinium
Redivivum calculates that the payments made to Gibbons for his
work in St Paul's amounted altogether to £1,337. 7s. 5d.[45]

Space fails to tell of many noble examples of eighteenth century


stallwork.[46] In spite of an enormous amount of destruction, e.g.,
by the vandals in charge of Canterbury cathedral, much still remains
and awaits the historian. A fine drawing of the stallwork put up in
1704 in Canterbury choir will be found in Dart's Canterbury. The
throne, carved by Grinling Gibbons, was given by Archbishop
Tenison; the pulpit, two of the stalls and other fittings by Queen
Mary II.;[47] all this has been swept away, except some pieces
worked into the return stalls, to make way for stalls of the usual
brand of Victorian Gothic.

CHAPTER VI

STALLS IN PARISH CHURCHES


Sall Trunch

Stalls are found, but rarely with canopies, in many parochial, as well
as in monastic, collegiate and cathedral churches. In the latter of
course the object of them is obvious; they were intended to
accommodate a large body of monks or canons with their vicars and
the choristers. But they are found sometimes in the churches of
quite small parishes, e.g., Sall, Trunch, Ludham, Burlingham St
Edmund's in Norfolk, Weston-in-Gordano, Somerset, Norton in
Suffolk, Ivychurch[48] in Romney Marsh, where it is pretty certain
that in most cases the church was served by a single parish priest
merely. At Ingham, a parish in the Norfolk Broads, there are ten
stalls in the chancel; at Stowlangtoft, Suffolk, there are six stalls;
and so with numerous others. How early parochial chancels had
stalls is difficult to say. No existing examples are earlier than the
thirteenth century. But a curious fact about the growth of our parish
churches, to which attention has not hitherto been directed, may
throw some light on the subject. In early Anglo-Saxon days the
normal and most common type of parish church was one which had
an aisleless nave and chancel. In early Norman days also this was
the most common type. In all the above churches, whether Anglo-
Saxon or Norman, the chancel, whether rectangular or apsidal, was
quite small. Comparatively few, however, of these chancels remain
small. In the vast majority of cases they have been enlarged. Either
the old chancel has been retained but has been lengthened, or it has
been broadened as well as lengthened, thus producing an entirely
new chancel. In most cases it happened that, in the long history of
the church, aisles were thrown out afterwards, or transepts, that
later the nave was lengthened westwards and was heightened to
accommodate clerestory windows, and still later a western tower
was added and perhaps a spire. But the enlargement of the chancel
sometimes took place without any of the other alterations, and
where that is so, i.e., where the church retains a comparatively small
nave, the enlarged chancel bulks up very lofty and spacious,
seemingly quite out of scale to the rest of the church: in some
examples the chancel is actually loftier than the nave. A church with
a chancel so disproportionate strikes the attention at once as one
demanding explanation. Large numbers of such abnormally big
chancels survive. In Kent and Sussex many of them are of the
thirteenth century; e.g., Littlebourne; while over England one is
struck with the very large number of lofty and spacious chancels of
the fourteenth century; e.g., Norbury, Derbyshire; Oulton, Suffolk. In
numerous cases the enlargements of the chancel took place more
than once. At Boston the church was rebuilt with a fine chancel c.
1330; but by the end of the century even this vast chancel was
judged inadequate, and it was extended still further to the east.

Hemingborough Church

What then is the explanation of this furore for enlargement of


chancels? In considering the answer, it must be borne in mind that,
ritualistically, the English parish church was always tripartite;
consisting of nave, choir and chancel. In churches of the Iffley type,
i.e., with a central tower, it was also architecturally tripartite. But
even in churches which architecturally were bipartite, i.e., which
consisted merely of a nave and chancel, the chancel was divided into
two parts, choir and sanctuary, the distinction between them being
marked by a change of level. Which part then was it that was found
inadequate, the sanctuary or the choir? Not the former; it was not
then cumbered with altar rails; the purpose they serve nowadays
was served by the screen which every church possessed, guarding
the entrance to the chancel; and the sanctuary was quite large
enough for the celebrant at the Mass, with as a rule a solitary
assistant, the parish clerk. It must have been the choir that was too
small for the seats which it was desired to place in it. We conclude
therefore that seats were common even in small village churches as
early as the thirteenth century, if not before. Documentary evidence
to that effect we have not. But in later days there is definite
evidence as to the practice of putting stalls in the chancels of parish
churches. In Hemingborough church, Yorkshire, there remain stalls
of graceful thirteenth century design (87). Now this church in the
thirteenth century was parochial; it did not become collegiate till
1426. A series of entries of the cost of choir stalls is preserved for
the parish church of St Mary at Hill in the City of London. In the year
1426 there was "paid to three carpenters for the stalls of the quire,
20d." In the following year there was paid "for the stalls of the
quire" the large sum of £12 (= £150); it would seem that it was
about this time that a complete new set of stalls was put into the
choir. In the same year, 1427, there was "paid for stalls in the quire,
16s. 6d."; and "for a quire stool, 7s. 10d." In 1501 a payment was
made "for mending of desks in the quire"; in 1509 "for nails and
mending of a bench in the quire, 1d." In 1523 there was "paid for a
long desk for the quire, 3s."; in 1526 "for the stuff and making of a
double desk in the quire, 5s." Then, in Protestant days, there was
"paid for mending the desk and settles in the chancel, 2s." At this
church the lower part of the bench was made to form a box or
chest.
Hereford St Peter's

Who then sat in these stalls? The common theory is that they were
intended for the use of the rector or vicar and the parish clerk, and
of any chantry priests who might be attached to the church. This no
doubt is true as far as it goes. At St Maurice, York, a complaint was
made at the visitation in 1416 to the effect that the desks in the
choir, viz., those where the parish chaplain and the parish clerk were
wont to sit, are unhandsome and in need of repair: "Dicunt quod
deski in choro, tam ex una parte quam ex alia, ubi saltem capellanus
parochialis et clericus parochialis sedere usi sunt, nimis deformes et
indigent reparacione."[49] To many churches also, but by no means
to all, chantry endowments were made; i.e., money was left that
masses might be said for ever for the repose of the soul of the
donor by a priest, other than the rector or vicar, specially appointed
for that purpose. It is commonly supposed that these chantry priests
were concerned only with the special altars at which they
ministered. But that this was not the case, at any rate universally, is
apparent from the terms of the institution of the Willeby chantry in
Halifax parish church. The deed is dated 10th June 1494. Amongst
other regulations it contains the provision that the chaplain is to
attend in person in the choir of the church on every Sunday and
Holy Day in his surplice, at matins, mass and vespers, and to take
his part in the reading and chanting, as directed by the vicar, and in
accordance with the constitutions of the Metropolitan Church. "Item
volo et ordino quod predictus Tho. Gledhill, Capellanus modernus, et
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like