Table Of ContentPDE Toolbox Primer for
Engineering Applications
with MATLAB® Basics
PDE Toolbox Primer for
Engineering Applications
with MATLAB® Basics
Leonid Burstein
MATLAB® is a trademark of The MathWorks, Inc. and is used with permission. The MathWorks
does not warrant the accuracy of the text or exercises in this book. This book’s use or d iscussion
of MATLAB® software or related products does not constitute endorsement or sponsorship
by The MathWorks of a particular pedagogical approach or particular use of the MATLAB®
software.
First edition published 2022
by CRC Press
6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742
and by CRC Press
4 Park Square, Milton Park, Abingdon, Oxon, OX14 4RN
© 2022 Leonid Burstein
CRC Press is an imprint of Taylor & Francis Group, LLC
Reasonable efforts have been made to publish reliable data and information, but the author and
publisher cannot assume responsibility for the validity of all materials or the consequences of
their use. The authors and publishers have attempted to trace the copyright holders of all m aterial
reproduced in this publication and apologize to copyright holders if permission to publish in this
form has not been obtained. If any copyright material has not been acknowledged please write
and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced,
transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or
hereafter invented, including photocopying, microfilming, and recording, or in any i nformation
storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, access www. copyright.
com or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA
01923, 978-750-8400. For works that are not available on CCC please c ontact mpkbookspermissions@
tandf.co.uk
Trademark notice: Product or corporate names may be trademarks or registered trademarks and
are used only for identification and explanation without intent to infringe.
ISBN: 978-1-032-05997-6 (hbk)
ISBN: 978-1-032-06022-4 (pbk)
ISBN: 978-1-003-20035-2 (ebk)
DOI: 10.1201/9781003200352
Typeset in Times
by codeMantra
To my dear family: wife Inna and son Dmitri,
and to my friends,
for memory…
Contents
Preface.................................................................................................................xv
Author ...............................................................................................................xvii
Chapter 1 Introduction .....................................................................................1
1.1 Preamble ...............................................................................1
1.2 A Bit of History and Advantages of the Software
Presented in This Book ........................................................1
1.3 The Goals of the Book and Its Audience .............................3
1.4 About the Material in the Chapters ......................................4
1.5 Material Arrangement in the Chapter and the
Available Program Editors ...................................................6
1.6 MATLAB® and PDE Toolbox Versions Used
in This Book .........................................................................7
1.7 The Order of Mastering the Material ...................................7
Chapter 2 Basics of the Software .....................................................................9
2.1 Introduction ..........................................................................9
2.2 Running the MATLAB® ......................................................9
2.2.1 Desktop, Toolstrip, and Main Windows ................10
2.2.1.1 Toolstrip .................................................10
2.2.1.2 Command Window ................................11
2.2.1.3 Workspace Window ...............................11
2.2.1.4 Current Folder Window .........................11
2.2.2 Simple Calculations and Math Functions..............12
2.2.3 About Online Help and Help Window ..................18
2.2.4 Available Toolboxes ..............................................20
2.2.5 Variables and Managing Them .............................22
2.2.6 Screen Output Formats ..........................................23
2.2.7 Commands for Output ...........................................24
2.2.8 Application Examples ...........................................26
2.2.8.1 Voltage between Intermediate
Points of the Wheatstone Bridge ...........26
2.2.8.2 Threaded Bolt: Stiffness Value
Estimation ..............................................27
2.2.8.3 Stress State for a Rectangular Plate
with a Crack ...........................................28
2.2.8.4 Bravais Lattice Cell Volume ..................29
2.3 Vectors, Matrices, and Arrays ............................................29
2.3.1 Managing Vectors, Matrices, and Arrays .............29
vii
viii Contents
2.3.1.1 Vector Representation ............................29
2.3.1.2 Matrices and Arrays Representation .....32
2.3.2 Mathematical Manipulations with Matrices .........34
2.3.2.1 Addition and Subtraction .......................34
2.3.2.2 Multiplication .........................................35
2.3.2.3 Division ..................................................37
2.3.3 Elementwise Operations ........................................38
2.3.4 Supplementary Commands for Matrix/Array
Manipulations ........................................................40
2.3.5 Strings as Variable and Strings as Matrix
Elements ................................................................51
2.3.6 About Displaying a Table ......................................52
2.3.6.1 The disp Command ...............................53
2.3.6.2 The fprintf Command ............................53
2.3.7 Application Examples ...........................................54
2.3.7.1 Cuboid Lattice Cell Volume ..................54
2.3.7.2 Table Containing Strings and
Numbers .................................................55
2.3.7.3 Voltage and Current in an
RC-type Circuit ......................................56
2.3.7.4 Momentary Position of the Piston Pin .....57
2.4 Flow Control .......................................................................58
2.4.1 Relational and Logical Commands .......................59
2.4.1.1 Relational Operators ..............................59
2.4.1.2 Logical Operators ..................................60
2.4.1.3 Application Example: Determining
Outlying Results in a Sample ................61
2.4.2 The If Statements ..................................................63
2.4.3 Loop Commands ...................................................64
2.5 Application Examples .........................................................66
2.5.1 Currents in an Electrical Circuit ...........................66
2.5.2 Resistance of Volume of a Material–Bulk
Modulus .................................................................68
2.5.3 Compression Piston Ring: Radial Thickness ........69
Chapter 3 Program Managing: Editor and Live Editor .................................73
3.1 Introduction ........................................................................73
3.2 Scripts and Script Files .......................................................73
3.2.1 Editor and Creating, Saving, and Running
a Script File ...........................................................73
3.2.1.1 Saving the Script File .............................75
3.2.1.2 About the Current Folder .......................76
3.2.1.3 Running Created Script File ..................77
Contents ix
3.2.2 Input Values to the Program Variables
from the Command Window .................................77
3.3 User-defined Functions and Function Files ........................78
3.3.1 Function Creation ..................................................78
3.3.1.1 Function Definition ................................79
3.3.1.2 Help Lines ..............................................80
3.3.1.3 Function Body, Local and
Global Variables ....................................81
3.3.2 About Function File ...............................................81
3.3.3 Running a User-defined Function .........................82
3.3.3.1 Comparison of Script and
Function Files ........................................83
3.3.4 Anonymous Function ............................................83
3.4 Interactive Script and Function Programs: Live Editor ......84
3.4.1 Opening the Live Editor ........................................84
3.4.2 Creating the Life Script .........................................85
3.4.3 Additional Information for Using the
Live Editor .............................................................87
3.4.3.1 Separate Sections in the Live Program .....87
3.4.3.2 Creating Live Function ..........................88
3.4.3.3 Converting a Script/Function to a
Live Script/Function ..............................88
3.4.3.4 Text Formatting Options ........................89
3.4.3.5 About the Interactive Controls ...............89
3.5 Application Examples .........................................................89
3.5.1 Converting Brinell Hardness to Vickers and
Rockwell Hardness ................................................90
3.5.2 Bending Shaft Stress .............................................91
3.5.3 Dew Point ..............................................................92
3.5.4 Live Function for Two-Stage Gear Train
Calculations ...........................................................93
Chapter 4 Basics of Graphics .........................................................................97
4.1 Introduction ........................................................................97
4.2 2D Plots Generating and Formatting ..................................97
4.2.1 One or More Curves on the 2D Plot ......................97
4.2.1.1 Using the Hold On/Off Command
for Generating Multiple Curves ...........109
4.2.2 Plot Formatting Using the Commands and
the Plot Tools Editor ............................................109
4.2.2.1 Formatting with Commands ................109
4.2.2.2 Interactive Plot Formatting ...................110
4.2.3 Several Plots in the Same Figure Window ...........113
4.3 Three-Dimensional Plots ...................................................114