Professional Documents
Culture Documents
A Matlab Primer For Technical Programming For Materials Science and Engineering 1st Edition Leonid Burstein
A Matlab Primer For Technical Programming For Materials Science and Engineering 1st Edition Leonid Burstein
https://textbookfull.com/product/a-research-primer-for-technical-
communication-methods-exemplars-and-analyses-george-f-hayhoe/
https://textbookfull.com/product/the-engineering-executives-
primer-impactful-technical-leadership-1st-edition-will-larson/
https://textbookfull.com/product/neural-data-science-a-primer-
with-matlab-and-python-erik-lee-nylen-and-pascal-wallisch-auth/
https://textbookfull.com/product/practical-social-engineering-a-
primer-for-the-ethical-hacker-1st-edition-joe-gray/
Biosurfaces a materials science and engineering
perspective 1st Edition Kantesh Balani
https://textbookfull.com/product/biosurfaces-a-materials-science-
and-engineering-perspective-1st-edition-kantesh-balani/
https://textbookfull.com/product/a-textbook-of-engineering-
mathematics-for-u-p-technical-university-lucknow-n-p-bali/
https://textbookfull.com/product/materials-for-biomedical-
engineering-fundamentals-and-applications-1st-edition-rahaman/
https://textbookfull.com/product/bioinspired-materials-science-
and-engineering-guang-yang/
Leonid Burstein
An imprint of Elsevier
Woodhead Publishing is an imprint of Elsevier
The Officers’ Mess Business Centre, Royston Road, Duxford, CB22 4QH, United Kingdom
50 Hampshire Street, 5th Floor, Cambridge, MA 02139, United States
The Boulevard, Langford Lane, Kidlington, OX5 1GB, United Kingdom
This book and the individual contributions contained in it are protected under copyright by the Publisher
(other than as may be noted herein).
Notices
Knowledge and best practice in this field are constantly changing. As new research and experience broaden our
understanding, changes in research methods, professional practices, or medical treatment may become necessary.
Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any
information, methods, compounds, or experiments described herein. In using such information or methods they should
be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility.
To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors, assume any liability for any
injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or
operation of any methods, products, instructions, or ideas contained in the material herein.
Library of Congress Cataloging-in-Publication Data
A catalog record for this book is available from the Library of Congress
Scientists, engineers, and students in materials science and engineering (MSE) perform
extensive technical calculations and apply computers and some special programs for this.
MATLAB® is a very popular software used in technical computing because of its efficiency
and simplicity. This book presents a primer in technical programming in MATLAB with
examples from the field of materials science, and addresses a wide MSE audience—
undergraduate and graduate students and practicing engineers. It provides the MATLAB
fundamentals with a variety of application examples and problems taken from materials
engineering, physics of materials and properties of substances, and material phenome-
non simulations that should facilitate learning the software language. I hope that many
nonprogrammer students, engineers, and scientists from MSE field will find the software
convenient for solving their specific problems.
The book accumulates many years of teaching experience in introductory and
advanced courses in the fields of MATLAB, material properties, and tribology that were
lectured for students, engineers, and scientists specializing in the area in question.
I thank MathWorks Inc.,a which kindly granted permission to use certain materials. I
am also grateful to the Elsevier Inc.b for permission to use the text, tables, figures, and
screenshots from my previous book “MATLAB in Quality Assurance Sciences” (Amster-
dam—Boston—Cambridge—Heidelberg—London—New York—Oxford—Paris—San
Diego—San Francisco—Singapore—Sydney—Tokyo, 2015).
I would also like to express appreciation to Stephen Rifkind, ITA Recognized Translator,
who edited the book.
I hope the primer will prove useful to students, engineers, and scientists in MSE areas
and enable them to work with the available fine software.
Any reports of errata or bugs, as well as comments and suggestions on the book will be
gratefully accepted by the author
Leonid Burstein
ORT BRAUDE COLLEGE OF ENGINE ERING, SOFTWARE ENGINEERING, KARMIEL, ISRAEL
a
The MathWorks, Inc., 3 Apple Hill Drive, Natick, MA 01760-2098, United States. Tel: +1-508-647-7000;
Fax: +1-508-647-7001. E-mail: info@mathworks.com; Web: www.mathworks.com.
b
The book was published by the Woodhead Publishing that is an imprint of Elsevier Inc., 50 Hampshire St.,
5th Floor, Cambridge, MA 02139, United States. Tel: +1-617-661-7057; Fax: +1-617-661-7061. E-mail:
permissions@elsevier.com; Web: https://www.elsevier.com.
ix
1
Introduction
The world is material: all different natural objects, plants, products, machines, and even
ourselves, are designed from various materials. Knowledge of the structure of matter as
well as the ability to create new and better materials with the desired properties are among
the most important goals of sciences and engineering in general and the science of mate-
rials in particular. Naturally, in materials sciences and engineering (MSE), as in other tech-
nological areas, calculations and computer modeling are widely used. For this purpose,
various kinds of software are used. Among them, MATLAB® has become one of the most
widespread and popular in programming for various technical applications. However, a
student, teacher, or MSE specialist just beginning to use the MATLAB® soon discovers that
each of the available MATLAB® books is designed for a wide range of specialists and that
there is no textbook specifically aimed for the problems that are encountered in technical
programming in the MSE fields. Overall, a large community of technicians needs a con-
cise, comprehensive text that is easy to understand and provides quick access to the nec-
essary tool. The presented edition aims to fill this gap.
https://doi.org/10.1016/B978-0-12-819115-6.00001-0
2 A MATLAB® Primer for Technical Programming in Materials Science and Engineering
during the first steps. The polynomial and optimization fitting (Chapter 4) can be pre-
sented after the section on 2D graphs (Chapter 2) for better illustration of the fitting
results. The ODE and PDE solutions (Chapter 6) can be moved before the fitting
(Chapter 4) as their solutions are not connected to curve fitting. Another way to teach
MATLAB® is to use the recent Life Editor (described in Chapter 4), which can be intro-
duced to beginners immediately after they become familiar with variables and interactive
calculations (prior to Section 2.1.5); this editor can be used throughout the rest of study
with examples of scripts/functions converted to a live file (as explained in Section 4.4.3).
In general, I hope the book will help MATLAB® users study the software and apply it to
MSE problems.
2
Basics of MATLAB®
Almost half a century has passed since a special computer tool was created for mathema-
ticians. The tool and its language were named MATLAB®. The term is derived from the
three first letters of two words, matrix and laboratory, to emphasize the main element
of this language: a matrix. This matrix-based approach unifies the calculating procedures
for both algebraic and graphical processing. Within a short period, MATLAB was adapted
and has become a convenient tool for technical computing. Today, engineers use it in a
variety of applied and scientific calculations of various fields, including material engineer-
ing. Over time, MATLAB has undergone significant changes. It has become more diverse,
effective, and complex. Therefore, it is necessary to study the available tool with the goal of
efficient technical programming for solving actual problems.
In this chapter, the tool desktop, its toolstrip, and available windows are presented; the
starting procedure is introduced; the main commands for simple arithmetical, algebraic,
matrix, and array operations are described; and finally, the basic loops and relational and
logical operators are explained.
Toolstrip
Current
Folder Workspace
Command Window
Window Window
2.1.1.1 Toolstrip
The toolstrip contains the main MATLAB purpose operations and functions, presented in
three global tabs: the Home, Plots, and Apps. The tabs are divided into sections that con-
tain a series of related controls, including buttons, drop-down menus, and other user
interface elements (Fig. 2.2). The tabs include a number of buttons that are grouped in
sections according to functionality (file, variable, code, etc.). The sections include buttons
for the execution of various operations (e.g., Open, New Variable, Preferences, etc.). The
Chapter 2 • Basics of MATLAB® 9
Home tab is the tab used most intensively and includes general purpose operations, such
as creating new files, importing data, and managing your workspace as well as the settings
of the Desktop layout. The Plots tab displays a gallery of plots available in MATLAB and
any toolboxes that you have installed. The Apps tab contains a gallery of applications from
the toolboxes.
The quick access toolbar is located to the right of the top of the strip. This toolbar con-
tains frequently used options such as Cut, Copy, and Paste. The Search Documentation
box is located next to the quick access toolbar and enables you to search for documenta-
tion about commands and other topics of interest.
The line with the current folder toolbar is placed on the bottom of the strip. This toolbar
controls the currently working directory.
The function button fx , appearing on the empty command line to the left of the
prompt, is called the Function browser. It helps us find the needed commands and infor-
mation about their syntaxes and usage.
Entering a command and manipulating it require us to master the following rules:
• The command must be typed next to the prompt >>;
• To execute the command, the Enter key must be pressed;
• A command in a preceding line cannot be changed; to correct or repeat an executed
command, press the up-arrow key ", and then introduce the desirable change in the
shown command followed by pressing the Enter key;
• A long command can be continued on the next line by typing ellipsis ... (three
periods); the total length of a single command may not exceed 4096 characters;
• Two or more commands can be written in the same line; in this case, they should be
divided by semicolons (;) or by commas (,);
• A semicolon entered at the end of the command withholds the display of the answer;
• The symbol % (percent symbol) designates the comments that must be written after it
in the line; the comments are not executed after entering;
• To clear the Command Window, enter the clc command from the command line;
• The result of entering a command is a variable with the name ans;
• The equal sign (=) is called the assignment operator and is used to specify a value for a
variable to the ans;
• An entered/computed new value cancels its predecessor in the variable, e.g., if the
value of a was assigned to be 4.3118, after entering the new command, >> a=16.3214,
the previous value of a is removed with a receiving the 16.3214 value.
The Command Window can be used as a calculator by using the following symbols for
arithmetical operations: + (addition), - (subtraction), * (multiplication), / (right division),
\ (left division, used mostly for matrices), ^(exponentiation).
Chapter 2 • Basics of MATLAB® 11
The given symbols are used in arithmetic, algebraic, or other math calculations, which
manipulate using a wide variety of elementary, trigonometric, and specific mathematical
functions. The MATLAB commands for calculations with these functions must be written
as the name with the argument in parentheses, e.g., cos x, be written as cos(x). Argument
x is given in radians in all trigonometric functions. If the appropriate command is written
with the ending letter d, e.g., cosd(x), the argument x should be given in degrees. The
inverse trigonometric functions with the ending d produce the result in degrees. A short
list of commands for calculations with math functions is given in Table 2.1. Hereinafter,
the commands/operators/variables that are entered in the Command Window are written
Table 2.1 Some commands for computing the elementary, trigonometric, and specific
mathematical functions (alphabetically).
Example of usage (input
MATLAB command Notation and output)
Continued
Chapter 2 • Basics of MATLAB® 23
If there is not enough space to display all the vector elements in one line, they are dis-
played in two or more lines with a message informing which column is presented in each
line. For example:
Fig. 61.—Air-bladder of
Otolithus sp.
Fig. 62.—Vertical section through
abdominal cavity of Collichthys lucida. b,
air-bladder; l, liver; s, stomach; epp and
ipp, external and internal laminæ of
peritoneum parietale; epv and ipv,
external and internal laminæ of
peritoneum viscerale; dv, dorsal air-
vessels; vv, ventral air-vessels.
Air-bladders without duct are found in Acanthopterygians,
Pharyngognaths, Anacanths, and Lophobranchs. They may consist
of a single cavity or divided by constrictions into two or three
partitions situated behind one another; they may consist of two
lateral partitions, assuming a horseshoe-like form, or they may be a
single sac with a pair of simple or bifid processes in front or behind
(Fig. 61). The families of Sciænidæ and Polynemidæ possess air-
bladders with a most extraordinary development of appendages
rising from each side of the air-bladder. In the Sciænoid (Fig. 63)
fifty-two branches issue from each side, each branch being bifurcate
and bearing smaller appendages. In Pogonias chromis (Fig. 64) the
sides of the anterior half is provided with irregular broad-fringed
appendages, the hindmost of which communicates by a narrow duct
with the posterior extremity of the air-bladder. In Collichthys lucida
(Fig. 62) twenty-five appendages issue from each side; the anterior
ones are directed towards the front, but the lateral assume a more
posterior direction, the nearer they are to the posterior extremity of
the air-bladder, where they form an assemblage giving the
appearance of a cauda equina. All these appendages soon bifurcate
in a dorsal and ventral stem; these stems bifurcate again and again,
and either terminate after the first or second bifurcation or are so far
prolonged as to reach the median line of the ventral and dorsal
sides, anastomosing with the branches of the other side. The
branches being enveloped in laminæ of the peritonæum, form a
dorsal and ventral sac of beautiful appearance, caused by the
regular arrangement of the air-vessels. The dorsal sac is situated
between the air-bladder and the roof of the abdominal cavity without
being attached to the latter. The ventral sac receives within its cavity
the intestine, liver, and ovaries.—A peculiar mechanism has been
observed in the air-bladder of the Ophidiidæ, the anterior portion of
which can be prolonged by the contraction of two muscles attached
to its anterior extremity, with or without the addition of a small bone.
Fig. 63.—Air-bladder of a
Sciænoid.
I. Visceral surface opened at
b, to show openings of the lateral
branches.
II. Isolated lateral branch; a,
its opening into the cavity of the
air-bladder.
Fig. 64.—Air-bladder of
Pogonias chromis.
Some Siluroids possess a peculiar apparatus for voluntarily
exercising a pressure upon the air-bladder. From the first vertebra a
process takes its origin on each side, expanding at its end into a
large round plate; this is applied to the side of the air-bladder, and by
pressing upon it expels the air through the duct; the small muscle
moving the plate rises from the skull.
The connection of the air-bladder with the organ of hearing in
some Physostomes has been described above, p. 117.
In the modifications of the air-bladder, hitherto mentioned, the
chief and most general function is a mechanical one; this organ
serves to regulate the specific gravity of the fish, to aid it in
maintaining a particular level in the water, in rising or sinking, in
raising or depressing the front part of its body as occasion may
serve. Yet a secretion of gas from the blood into its cavity must take
place; and if this be so, it is not at all impossible that also an
exchange of gases between the two kinds of blood is effected by
means of the extraordinary development of retia mirabilia in many
air-bladders.
In all fishes the arteries of the air-bladder take their origin from
the aorta or the system of the aorta, and its veins return either to the
portal, or vertebral, or hepatic veins; like the other organs of the
abdominal cavity it receives arterial blood and returns venous blood.
However, in many fishes the arteries as well as veins break up below
the inner membrane into retia mirabilia in various ways. The terminal
ramifications of the arteries may dissolve into fan-like tufts of
capillaries over almost every part of the inner surface, as in
Cyprinoids. Or these tufts of radiating capillaries are more localised
at various places, as in Esocidæ; or the tufts are so aggregated as to
form gland-like, red bodies, the capillaries reuniting into larger
vessels, which again ramify freely round the border of the red body;
the red bodies are formed not only by minute arteries but also by
minute veins, both freely anastomosing with its kind, and being
inextricably interwoven. The rest of the inner surface of the air-
bladder receives its blood, not from the red bodies, but from normally
ramifying vessels. This kind of rete mirabile or “vaso-ganglion” is
found in the Perch and Gadoids; it is generally distributed in closed
air-bladders, but also sometimes observed in air-bladders’ with
pneumatic duct. In Anguilla and Conger two similar vaso-ganglia are
situated at the sides of the opening of the pneumatic duct.
Fig. 65.—Lung of Ceratodus opened in its
lower half to show its cellular pouches. a, Right
half; b, Left half; c, Cellular pouches; e, Vena
pulmonalis; f, Arterial blood-vessel; oe,
Œsophagus opened, to show glottis (gl.)
Whilst the air-bladders of some Ganoids, anatomically as well as
functionally, closely adhere to the Teleosteous type, that of Amia is
more cellular and lung-like in its interior than the Teleosteous air-
bladder, and Polypterus approaches the Dipnoi not only in having a
laterally divided air-bladder but also in its pneumatic duct entering
the ventral side of the œsophagus. The air-bladder of the Dipnoi
possesses still more the anatomical characteristics of a lung and
assumes its functions, though, as it co-exists with gills, only
periodically or in an auxiliary manner. The ductus pneumaticus is a
membranous bronchus, entering the ventral side of the œsophagus,
and provided at its entrance with a glottis. In Ceratodus (Fig. 65) the
lung is still a single cavity, but with a symmetrical arrangement of its
internal pouches; it has no pulmonal artery, but receives branches
from the arteria cœliaca. Finally, in Lepidosiren and Protopterus the
lung is completely divided into lateral halves, and by its cellular
structure approaches most nearly that of a reptile; it is supplied with
venous blood by a true pulmonary artery.
Fig. 66.—Heart of Lepidosteus osseus.
I. External aspect. II. Conus arteriosus opened.
a, Atrium; b, Conus arteriosus; v, Ventricle; h,
Branchial artery for 3d and 4th gill; k, for the
second; l, for the first; m, branch for the opercular
gill; d, Single valve at the base of the conus; e-g,
Transverse rows of Ganoid valves.
CHAPTER X.
ORGANS OF CIRCULATION.
URINARY ORGANS.