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 materials in particular. Naturally, in materials sciences and engineering (MSE), as in other technological 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 concise, comprehensive text that is easy to understand and provides quick access to the necessary tool. The presented edition aims to fill this gap.
1.1 Some history
The theoretical basics of the MATLAB® language were established in the 1970s by the mathematician Cleve Moler and perfected by the specialists that joined him. First, the language was oriented to the adaptation of the mathematical packages of that time, LINPACK and EISPACK. In a short time, MATLAB® was considered by students and engineers an effective and suitable tool not only for mathematical but also for many technical problems. The language was rewritten in C. Commercial MATLAB® versions have appeared since the mid-1980s in the general software market. By incorporating graphics and development of the special engineering-oriented means—toolboxes—MATLAB® acquired its modern outlines. In general, MATLAB® is a unique assembly of implemented modern numerical methods and specialized tools for engineering calculations developed over the past decades. MATLAB® competes with other software and has established its special place as the software for technical computations. Without going into detail, the following factors and their combinations provide advantages to MATLAB®:
- • Versatility and the ability to solve both simple and complex problems with its easy-to-use facilities;
- • Highest adaptability to different areas of engineering and science as reflected in a significant number of the problem-oriented toolboxes;
- • Convenience and a variety of visualization means for general and specific problems, e.g., MSE problems;
- • Quick, simple access to well-organized, extensive documentation.
1.2 Purpose and audience of the book
The purpose of this primer is to provide MSE students, academicians, teachers, engineers, and scientists with a guide that will teach them how to create programs suitable for their professional calculations and present the results in descriptive, graphical, and tabular forms. It is assumed that the reader has no programming experience and will be using the software for the first time. In order to make the primary programming steps and use of commands clear to the target audience, they are demonstrated by problems taken from different areas of materials science whenever possible. Among the variety of available software, MATLAB® distinguishes itself as the tool for technical analysis and calculations. It is renewed and refined in parallel with the developments in modern technology. Modern material sciences specialists intensively used computers with some special programs, and therefore need a universal tool for solving specific problems from their area. Thus, the book serves as a guide to MATLAB® with examples from the field of material engineering and is addressed to undergraduate, graduate, and postgraduate students as well as nonprogrammer technicians that want to master the MATLAB® program to solve problems arising in their areas.
Most of the existing books on the various aspects of MATLAB® can be roughly divided into two kinds: (a) MATLAB® programming books and (b) advanced engineering, science, or mathematics books with MATLAB®-introductory section/s. The first category assumes that the reader is already familiar with math methods and concentrates on programming technique. The second category is generally devoted to special subjects on a somewhat advanced level. This book is different in that it assumes the reader possesses a modest mathematical background and introduces the programming or technical concepts together with a traditional approach. MATLAB® is then used as a tool for subsequent computer solutions, applying it to mechanical and material science problems. An additional distinction of the book is its relatively compact size combined with a variety of examples from a broad range of modern and classical mechanics and material sciences, which help solidify the understanding of the presented material.
In accordance with the foregoing, the principal audiences of the book include:
- – Students, engineers, managers, and teachers from the academic and scientific communities in the field of materials science;
- – Instructors and their students in MSE study program courses where MATLAB® is used as a supplemental but necessary tool;
- – Personnel at materials testing laboratories, students, and nonprogrammers using MATLAB®;
- – Students and participants in advanced MSE courses, seminars, or workshops where MATLAB® is taught;
- – Scientists who seek to solve MSE-scientific problems and search for similar problems solvable with MATLAB®;
- – Self-instructing readers as a means of quick mastering of MATLAB® for their needs.
The book will also serve non-MSE specialists as a reference in numerical applications that require a computer tool for modeling and solving actual engineering problems.
1.3 About the book topics
The topics were selected based on more than 20 years of research experience and 15 years of teaching experience in the fields of tribology, materials and substances properties, and MATLAB®. They were presented so that the beginner can progress gradually using only previously acquired material as prerequisites for each new chapter.
The most important, basic MATLAB® features, including the desktop environment, language design, help options, variables, arithmetical and algebraic functions and operations, matrix and array creation and manipulations with their flow chart control, and conditional statements, are introduced in the second chapter. A command of this material enables the reader to write, execute, and display the simple calculations directly in the command window.
The third chapter presents visualization means by examples of various two- and three-dimensional plots representing the actual calculations. Understanding the material of the second and third chapters allows the reader to create rather complex MATLAB® programs for technical calculations and their graphical representation.
The fourth chapter shows how to create programs in the form of scripts or user-defined functions and then save them as an m-file. The chapter includes the Live Editor, live scripts, and function descriptions and demonstrates their use by the MSE-oriented example. In this chapter, the supplementary commands for common numerical calculations, such as finding the solution of the equation, inter- and extrapolation, differentiation and integration, are discussed together with examples from the MSE fields.
The fifth chapter presents more advanced topics, including the fitting experimental, tabular, or theoretical data. Polynomial fitting, fitting by optimization, and the use of the Basic Fitting interface are described with both single and the multivariate fittings presented.
The final sixth chapter is intended for more advanced readers and explains the specialized commands for solving ordinary differential equations (ODEs), spatially one-dimensional partial differential equations (PDEs), and PDE. The modeler interface for two-dimensional PDEs is briefly presented with examples related to diffusion, heat transfer, and wave equations. To understand this chapter, a familiarity with mathematics on a somewhat higher level is assumed.
The appendix presents a summary collection of approximately 200 studied MATLAB® characters, operators, commands, and functions.
The index contains more than 700 alphabetically arranged names, terms, and commands that were implemented throughout the book.
1.4 The structure of the chapters
Each chapter begins with a general introduction, goals, and chapter content. The new material, main command forms, and its application are then presented. The commands are typically explained in one or two simple forms with possible useful extensions given. Each topic is completely presented in one section in order to allow the readers to attain the knowledge in a focused manner. Tables listing the additionally available commands that correspond to the topic, command description, and examples are included in the chapter.
At the end or middle of the chapter, application problems associated with the MSE area are solved with the commands accessible to the reader. The given solutions are the easiest to understand but not necessarily the shortest or original. Readers would find it useful and are encouraged to try their own solutions and compare the results with those in the book.
For better application, the questions and problems for self-testing are given at the end of each chapter; the first ten questions are MATLAB®-oriented, and all other exercises are related to various MSE disciplines. I recommend solving them to attain better understanding of MATLAB®. At the end of each chapter, the answers to some of the exercises are provided.
It should be noted that the numerical values and contexts used in the various problems of the book are not factual reference data and serve for educational purposes only.
1.5 About MATLAB® versions
Annually, two new versions of MATLAB® appear. Although each version is updated and extended, they allow work with previously written commands. Thus, the basic commands described in this book will remain valid in any future versions. The version used in this book is R2018b (9.5.0.944444). It is expected that readers have MATLAB® installed on their computer and will be able to perform all the basic operations presented in the book.
1.6 Order of presentation
The book presents a MATLAB® primer oriented to a newcomer in computer calculations, with the topics then arranged accordingly. Nevertheless, a teacher is not obligated by this order. For example, the Editor (Section 4.1) can be taught directly after the output commands (Section 2.1.7) to permit the simple program creations on the early learning stages. Likewise, the material regarding creation of script files (Section 4.1) can be studied after the input and output...