MATLAB for Engineering Applications, 5e ISE 5th/ISE Edition William J. Palm Iii pdf download
MATLAB for Engineering Applications, 5e ISE 5th/ISE Edition William J. Palm Iii pdf download
https://ebookmass.com/product/matlab-for-engineering-
applications-5e-ise-5th-ise-edition-william-j-palm-iii/
https://ebookmass.com/product/ise-matlab-for-engineering-
applications-5th-edition-william-palm/
https://ebookmass.com/product/system-dynamics-4th-edition-william-j-
palm/
https://ebookmass.com/product/ise-ethics-in-engineering-5th-edition-
mike-martin-prof/
Oil Palm Biomass for Composite Panels: Fundamentals,
Processing, and Applications S.M. Sapuan
https://ebookmass.com/product/oil-palm-biomass-for-composite-panels-
fundamentals-processing-and-applications-s-m-sapuan/
https://ebookmass.com/product/divine-agency-and-divine-action-volume-
iii-systematic-theology-william-j-abraham/
https://ebookmass.com/product/matlab-programming-for-engineers-6th-
edition-stephen-j-chapman/
https://ebookmass.com/product/traffic-and-highway-engineering-5th-
edition-garber-nicholas-j/
https://ebookmass.com/product/classroom-discipline-nd-
management-5e-5th-edition/
MATLAB® for
page i
Engineering
Applications
Published by McGraw Hill LLC, 1325 Avenue of the Americas, New York,
NY 10019. Copyright ©2023 by McGraw Hill LLC. All rights reserved.
Printed in the United States of America. No part of this publication may be
reproduced or distributed in any form or by any means, or stored in a
database or retrieval system, without the prior written consent of McGraw
Hill LLC, including, but not limited to, in any network or other electronic
storage or transmission, or broadcast for distance learning.
1 2 3 4 5 6 7 8 9 LCR 27 26 25 24 23 22
ISBN 978-1-265-13919-3
MHID 1-265-13919-9
All credits appearing on page or at the end of the book are considered to be
an extension of the copyright page.
The Internet addresses listed in the text were accurate at the time of
publication. The inclusion of a website does not indicate an endorsement by
the authors or McGraw Hill LLC, and McGraw Hill LLC does not
guarantee the accuracy of the information presented at these sites.
mheducation.com/highered
To my sisters, Linda and Chris, and to my parents, page iii
CHAPTER 1
An Overview of MATLAB® 3
1.1 MATLAB Interactive Sessions 4
1.2 The Toolstrip 17
1.3 Built-In Functions, Arrays, and Plots 18
1.4 Working with Files 24
1.5 The MATLAB Help System 32
1.6 Problem-Solving Methodologies 35
1.7 Summary 42
Problems 43
CHAPTER 2
Numeric, Cell, and Structure Arrays 51
2.1 One- and Two-Dimensional Numeric Arrays 52
2.2 Multidimensional Numeric Arrays 61
2.3 Element-by-Element Operations 62
2.4 Matrix Operations 72
2.5 Polynomial Operations Using Arrays 91
2.6 Cell Arrays 96
2.7 Structure Arrays 98
2.8 Summary 102
Problems 103
CHAPTER 3
Functions 121
3.1 Elementary Mathematical Functions 121
3.2 User-Defined Functions 128
3.3 Additional Function Types 143
3.4 File Functions 158
3.5 Summary 160
Problems 161
CHAPTER 4
Programming with MATLAB 169
4.1 Program Design and Development 170
4.2 Relational Operators and Logical Variables 177
4.3 Logical Operators and Functions 179
4.4 Conditional Statements 186
4.5 for Loops 194
4.6 while Loops 206
4.7 The switch Structure 212
4.8 Debugging MATLAB Programs 214
4.9 Additional Examples and Applications 217
4.10 Summary 231
Problems 232
CHAPTER 5
Advanced Plotting 251
5.1 xy Plotting Functions 251
5.2 Additional Commands and Plot Types 261
5.3 Interactive Plotting in MATLAB 278
5.4 Three-Dimensional Plots 280
5.5 Summary 286
Problems 287
CHAPTER 6
Model Building and Regression 299
6.1 Function Discovery 299
6.2 Regression 310
6.3 The Basic Fitting Interface 326
6.4 Summary 329
Problems 330
7
page vi
CHAPTER
Statistics, Probability, and Interpolation 341
7.1 Statistics and Histograms 342
7.2 The Normal Distribution 346
7.3 Random Number Generation 352
7.4 Interpolation 361
7.5 Summary 370
Problems 370
CHAPTER 8
Linear Algebraic Equations 379
8.1 Matrix Methods for Linear Equations 380
8.2 The Left-Division Method 383
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
8.3 Underdetermined Systems 389
8.4 Overdetermined Systems 398
8.5 A General Solution Program 402
8.6 Summary 404
Problems 405
CHAPTER 9
Numerical Methods for Calculus and Differential Equations
419
9.1 Numerical Integration 420
9.2 Numerical Differentiation 428
9.3 First-Order Differential Equations 431
9.4 Higher-Order Differential Equations 439
9.5 Special Methods for Linear Equations 445
9.6 Summary 458
Problems 459
CHAPTER 10
Simulink 471
10.1 Simulation Diagrams 472
10.2 Introduction to Simulink 473
10.3 Linear State-Variable Models 478
10.4 Piecewise-Linear Models 481
10.5 Transfer-Function Models 487
10.6 Nonlinear State-Variable Models 489
10.7 Subsystems 491
10.8 Dead Time in Models 496
10.9 Simulation of a Nonlinear Vehicle Suspension Model 499
10.10 Control Systems and Hardware-in-the-Loop Testing 503
10.11 Summary 513
Problems 514
CHAPTER 11
Symbolic Processing with MATLAB 525
11.1 Symbolic Expressions and Algebra 527
11.2 Algebraic and Transcendental Equations 536
11.3 Calculus 543
11.4 Differential Equations 555
11.5 Laplace Transforms 562
11.6 Symbolic Linear Algebra 570
11.7 Summary 575
Problems 576
CHAPTER 12
Projects with Matlab 589
12.1 MATLAB Mobile 590
12.2 Programming Game Projects in MATLAB 595
12.3 The MATLAB App Designer 600
APPENDIX A
Guide to Commands and Functions in This Text 603
APPENDIX B
Animation and Sound in MATLAB 615
APPENDIX C
References 626
APPENDIX D
Formatted Output in MATLAB 627
Answers to Selected Problems 631
Index 634
Numbered Examples page vii
F
ormerly used mainly by specialists in signal processing and numerical
analysis, MATLAB® has achieved widespread and enthusiastic
acceptance throughout the engineering community. Many engineering
schools require a course based entirely or in part on MATLAB early in the
curriculum. MATLAB is programmable and has the same logical,
relational, conditional, and loop structures as other programming languages.
Thus it can be used to teach programming principles. In most engineering
schools, MATLAB is the principal computational tool used throughout the
curriculum. In some technical specialties, such as signal processing and
control systems, it is the standard software package for analysis and design.
The popularity of MATLAB is partly due to its long history, and thus it is
well developed and well tested. People trust its answers. Its popularity is
also due to its user interface, which provides an easy-to-use interactive
environment that includes extensive numerical computation and
visualization capabilities. Its compactness is a big advantage. For example,
you can solve a set of many linear algebraic equations with just three lines
of code, a feat that is impossible with traditional programming languages.
MATLAB is also extensible; currently more than 30 “toolboxes” in various
application areas can be used with MATLAB to add new commands and
capabilities.
MATLAB is available for a number of operating systems. It is
compatible across all these platforms, which enables users to share their
programs, insights, and ideas. This text is based on release R2021a of the
software. This includes MATLAB version 9.10. Some of the material in
Chapter 9 is based on the Control System toolbox, Version 10.10. Chapter
10 is based on Version 10.3 of Simulink®, and Chapter 11 is based on
Version 8.7 of the Symbolic Math toolbox.
TEXT ORGANIZATION
In addition to updating material from the previous edition to include new
features, new functions, and changes in syntax and function names, the text
incorporates the many suggestions made by reviewers and other users.
More examples and homework problems have been added.
The text consists of 12 chapters. The first five chapters constitute a basic
course in MATLAB. The remaining seven chapters are independent of each
other and cover more advanced applications of MATLAB, the Control
Systems toolbox, Simulink, and the Symbolic Math toolbox.
Chapter 1 gives an overview of MATLAB features, including its
windows and menu structures. It also introduces the problem-solving
methodology.
Chapter 2 introduces the concept of an array, which is the fundamental
data element in MATLAB, and describes how to use numeric arrays, cell
arrays, and structure arrays for basic mathematical operations.
Chapter 3 discusses the use of functions and files. MATLAB has an
extensive number of built-in math functions, and users can define their own
functions and save them as a file for reuse.
Chapter 4 introduces programming with MATLAB and covers relational
and logical operators, conditional statements, for and while loops, and the
switch structure.
Chapter 5 deals with two- and three-dimensional plotting. It first
establishes standards for professional-looking, useful plots. In the author’s
experience, beginning students are not aware of these standards, so they are
emphasized. The chapter then covers MATLAB commands for producing
different types of plots and for controlling their appearance. The Live
Editor, which is a major addition to MATLAB, is covered in Section 5.1.
Chapter 6 covers function discovery, which uses data plots to discover a
mathematical description of the data and is a useful tool for model building.
It is a common application of plotting, and a separate section is devoted to
this topic. The chapter also treats polynomial and multiple linear regression
as part of its modeling coverage.
Chapter 7 reviews basic statistics and probability and shows how to use
MATLAB to generate histograms, perform calculations with the normal
distribution, and create random number simulations. The chapter concludes
with linear and cubic spline interpolation.
Chapter 8 covers the solution of linear algebraic equations, which arise in
applications in all fields of engineering. This coverage establishes the
terminology and some important concepts required to use the computer
methods properly. The chapter then shows how to use MATLAB to solve
underdetermined and overdetermined systems of linear equations.
"Well, how have you done to-day?" asked Sam Pepper, when Nelson
entered the lunch-room and came to the rear, where Pepper stood
mixing some liquors.
"Oh, I sold quite a few papers," answered Nelson.
"How many?"
"Over a hundred."
"Then I guess you made over a dollar?"
"I did."
"That's more than I've made to-day," growled Pepper. "Business is
growing worse and worse."
Nelson knew that he must have made more than a dollar, but he did
not say anything on the point. He saw that Sam Pepper was in an
ugly mood.
"It seems to me you ought to begin paying something for your
keep," went on the lunch-room keeper, after he had returned from
serving the drinks he had been mixing.
"All right, I'm willing," said Nelson readily. "But I don't get much
from here now, remember."
"It's not my fault if you are not here at dinner time. Plenty of eating
going to waste."
"I am not going to eat other folks' left-overs," said the newsboy,
remembering the offer made to him several days before.
"Those left-overs are good enough for the likes of you, Nelson. Don't
git high-toned before you can afford it."
"What do you want me to pay?"
"You ought to pay me at least five dollars a week," growled Sam
Pepper, after a crafty look into the boy's face.
"Five dollars a week!" ejaculated Nelson in surprise. "Why, I don't
make it, excepting when business is good."
"Well, it's got to be five dollars a week after this."
"I can get board at other places for three."
"You won't go to no other place. You'll stay here, and if you make a
dollar or more a day you'll pay me the five dollars."
"But who will buy me any clothes?"
"Aint that suit good enough?"
"No, it's not. I was saving up to buy another suit, but Billy Darnley
stole five dollars of the savings from me this morning," went on
Nelson bitterly.
"Stole five dollars from you? I don't believe you."
"It's true."
"Then you ought to lose the money, seeing that you didn't pass it
over to me," grumbled Sam Pepper. "After this, you let me save your
money for you."
At this point some customers came in, and Sam had to wait on
them. Seeing this, the newsboy passed around the bar and into the
two rooms which he and Pepper called home. They were gloomy
and foul-smelling, but the newsboy did not mind this, for he was
used to the surroundings. Yet his heart was heavy, as he threw
himself into a dilapidated chair and gave himself up to his thoughts.
The new suit of clothes seemed further off than ever, for, if he must
pay Sam Pepper five dollars a week for his board, it would be utterly
impossible for him to save a cent. The extra money would be
needed to buy fresh papers each day.
"It isn't fair!" he muttered. "It isn't fair, and I won't stand it! I'll run
away first; that's what I'll do!"
Running away was no new idea, but, as before, he thought of the
past and of what Sam Pepper might have locked up in his breast.
No, it would not do to go away. He must unlock the mystery of the
past first.
"I'll question Sam to-night, and I'll make him tell something," he
said.
The resolve had hardly crossed his mind when Pepper opened the
door with a bang, as it flew back against the wall.
"Come out here and help me," he snarled. "There is plenty of work
to do. The kitchen woman has left me in the lurch. Throw off your
coat and git into that dishpan, and be lively about it."
Without a word, Nelson did as bidden. He had washed dishes before,
and though the pile beside him was by no means small, he soon
made away with them. Then Pepper set him to polishing up the
knives, forks, and spoons, and this task took until it was time to
close for the night.
After the lunch-room had been locked up, and most of the lights put
out, Sam Pepper went to the bar and mixed himself an extra-large
glass of liquor. This was his "nightcap," as he called it, and usually,
after drinking it, he would retire.
To-night, however, after consuming the liquor, he went into one of
the back rooms and got out his best coat and his hat.
"I'm going out an hour or so," he said. "You keep good watch while
I'm away."
"All right," answered Nelson. He was disappointed at not being able
to question Pepper, but saw there was no help for it. Soon the man
was gone, and Nelson was left alone. Pepper had locked the street
door and taken the key with him.
The day's work had made Nelson tired, but he was in no humor for
sleeping, and tumbled and tossed for a long while after lying down
upon his hard couch. He thought of the stout gentleman, of the big
newsboy who had robbed him, and of the kind young lady who had
offered him assistance. For some reason he could not get the young
lady out of his mind, and he half wished he might see her again.
Then his thoughts came back to himself. Who was he, and how had
he come into Sam Pepper's care? Surely the man must know all
about the past. What could Pepper be hiding from him?
At last he fell asleep, and did not rouse up until early morning. Sam
Pepper was just returning, and a glance showed that the man was
more than half under the influence of liquor.
"It's a good game," muttered Pepper to himself, as he stumbled
around, preparing to retire, "A good game, and it will make me rich.
And Nelson shall help me, too."
"Help you at what?" asked the newsboy sleepily.
"Never mind now, you go to sleep," answered Pepper sharply.
He pitched himself on his bed and was soon snoring lustily, and
seeing this Nelson did not attempt to disturb him. He slept soundly
for the rest of the night, and by six o'clock was outdoors and on his
way to get his supply of morning papers.
Pepper had warned him to come back by eleven o'clock, to go at the
dishes again, for the kitchen woman was not coming back. This
made him cautious about investing in newspapers. However, trade
proved brisk, and by ten o'clock he had sold out, and cleared sixty
cents.
"I won't buy any more papers until after dinner," he said to himself.
"I'll walk down to the ferry and see if I can find out anything about
Billy Darnley."
At the ferry there was the usual rush of passengers, the noise of the
heavy trucks coming and going, and the shrill cries of the newsboys.
Nelson stopped near the ferryhouse to view the scene.
Hardly had he paused when his attention was attracted to a quarrel
between a large newsboy and a small one. The larger lad was
shaking his fist in the face of the smaller.
"You keep away from dis corner, Paul Randall!" said the big newsboy.
"If yer don't I'll fix yer, remember dat!"
"I have as much right here as you, Len Snocks!" replied the little
fellow.
"Yer aint got no right here at all!" blustered Len Snocks. "Dis is my
spot, see?"
"You didn't pay for it."
"Don't yer talk back ter me!" howled Len Snocks, and catching the
little lad's stock of papers he threw them down in the mud of the
street. "Now clear out, or I'll t'row you down de same way," he went
on.
The scene made Nelson's blood boil. He recognized both boys, and
knew that Paul Randall helped support a mother who was half blind.
Len Snocks was a bully belonging to the crowd with whom Billy
Darnley associated.
Rushing across the roadway, Nelson caught Len Snocks by the arm
and held him tightly.
"You big brute!" he cried. "Why don't you tackle a fellow your own
size?"
"Oh, Nelson, he has spoiled my papers!" sobbed Paul, running to
save what was left of the stock.
"Lemme go!" snarled Len Snocks. "Lemme go, do yer hear?"
"You must give Paul clean papers for the dirty ones," returned
Nelson firmly.
"I won't do it!"
"I'll make you do it."
"Make me?" roared Len. "I'd like to see you try it."
In a twinkle Nelson placed one foot behind the bully. Then he gave
the big newsboy a shove which landed him flat on his back. On the
instant he was down on top of Len.
"How many papers are dirty, Paul?" he asked.
"Two Suns, a World, and a Journal," was the quick answer.
"Take 'em out of Len's pile."
"Lemme up, or I'll kill you!" howled the bully, and struggled to arise.
But Nelson was master of the situation. He continued to hold Len
down, and did not let go until Paul had the papers he wished. Then
he leaped up, squared off on the defensive, and awaited the
outcome of the encounter. Paul lost no time in placing himself
behind his newly found champion.
CHAPTER IV.
DOWN AT THE FERRY.
Locking the front door to the lunch-room, Pepper came to the rear
of the place, poured himself a glass of liquor and tossed it off, and
then sank in a chair by the last table.
"Sit down, Nelson," he said.
The boy sat down and gazed curiously at the man before him.
Instinctively he realized that a crisis in his life was approaching. He
felt that the old life was speedily to become a thing of the past.
"Nelson, aint you often wondered who you was?" went on Pepper.
"To be sure I have!" cried the boy. "But you will never tell me
anything," he added bitterly.
"Well, I kept the secret for your own good, my boy."
"How?"
"When I came to New York and settled on the East Side I made up
my mind to lead an honest life and bring you up honestly. I did it,
too; didn't I?"
"So far as I know, yes."
"I did it, but it was hard scratching, and you know it. Many were the
times I didn't know how to turn myself, and if it hadn't been for
some friends helping me, I would have gone under. Those friends
were the only ones I ever knew. They weren't honest, but—well,
we'll let that pass. They helped me, and I aint going back on 'em."
"But what about me?"
"I'm coming to that, Nelson. As I said before, I wanted to bring you
up honestly; for your mother was honest, even if your father
wasn't."
"My father!" ejaculated the newsboy. "What was he?"
"He was a good-hearted man, Nelson—a fine-hearted man, who did
lots of good."
"But you said he wasn't honest."
"No, he wasn't, if you must know. He was a burglar, and made his
living by taking from the rich what they didn't deserve to have. He
was my friend, and he was one of the men who helped me when I
lost all I had at the yacht races."
"But—but I don't understand," faltered Nelson. "What was his
name?"
"I can't tell you that."
"Is he dead?"
"Yes; he died when you was a little kid not more than three years
old. We both lived in another city then—I won't tell you where. Your
father was shot while entering a house to rob a man who had once
robbed him when he was in business. Your father died in a hospital,
and I was with him. Your mother was dead, and he didn't know what
to do with you. I said I'd take you, and he made me promise to go
to sea first and then to another city and bring you up the best I
could. He didn't want you to know your name, and so I got to calling
you Nelson after the English admiral, and you can sign yourself
Nelson Pepper after this, if you want to."
"Then you won't tell me where I came from?"
"No; excepting that it was a good many miles from here. It wouldn't
do any good to rake up old scores. If your father hadn't died of the
shot, he would have been sent to prison for ten or fifteen years."
"What was the name of the man who shot him?"
"It won't do you any good to know that, either—he's dead and gone,
too."
There was a pause, and the newsboy gave something like an inward
groan. The revelation that Pepper had made was truly a shocking
one, and the boy was so dazed and bewildered he could scarcely
think. His father a burglar, and shot down while in the act of
committing a robbery! What a degradation!
"I've told you all this for a purpose," went on the man. "Now I've got
some more to tell you, if you'll promise to keep your mouth shut."
"What else is there?"
"Will you keep silent if I tell you?"
"Yes."
"And do you promise not to say a word of what I have just told
you?"
"Why should I—it wouldn't be anything to my credit," answered
Nelson.
"But I want you to promise."
"All right; I promise."
"That's good. I know if you give your word you'll keep it. Now, I've
got a plan in my head to square accounts, so to speak, and git rich
at the same time."
"What plan?"
"Well, you see, it's like this: There's a rich gent lives up near Central
Park. I won't give you his name, but I don't mind telling you that
he's a distant relative of the fellow who shot your father, and he
used to help that other man in his dealings against your father. I
don't know as he remembers your father now, but he's a man you
ought to get square on, anyway."
"How?"
"I'm coming to that, my boy. This man is old and feeble and has
something of an office in his library at home. There is a safe in the
library, but it's old-fashioned and can easily be opened. In that safe
the old man keeps thousands of dollars all the time, for it's too much
for him to go back and forth to the bank, and he aint the one to
trust anybody else."
Sam Pepper paused suggestively and looked Nelson full in the eyes.
Then he began to whistle softly to himself.
"Do you mean that you think I ought to rob that safe?" questioned
our hero.
"You won't have to do the job alone, lad; I'll be on hand to help
you."
"But I—I never stole anything in my life."
"It won't be stealing, exactly. That man owes you something. If it
hadn't been for him and his relative your father might have been rich
and never got into any burglary. I have looked the ground over, and
the job will be dead easy. There is a back alley and an iron fence
that both of us can climb over without half trying. Then I can git a
diamond cutter for the window glass, and the rest will be just as
easy as wink."
"And if you are caught, what then?"
"We won't git caught, Nelson. The old man has only a niece living
with him, a girl of seventeen or eighteen, and an old housekeeper
who is half deaf. The rest of the help comes in the morning and
leaves after supper."
There was another pause. Nelson sank beside the table, with his
face in his hands. Suddenly he looked at Sam Pepper again.
"Did you say that man had robbed my father—I mean the man who
shot him?"
"Sure he did, Nelson."
"Then perhaps my father wasn't a burglar, after all. Perhaps he was
entering the house to get evidence against the man."
"No, he went in to—er—well, to steal, if you must have it straight."
"Sam Pepper, I don't believe you!"
"Nelson!"
"I don't believe you, so there! You won't tell me my name, or where
I came from, or anything, and you are only trying to make out my
father was a thief so as to get me to turn thief, too."
"I've told you the truth, lad."
"And I repeat I don't believe you. What is more, I won't help you in
your plans of robbery. I've been honest so far, and I mean to remain
honest. You ought to be ashamed of yourself for trying to make me
a thief."
The newsboy had risen to his feet and, as he spoke, his face glowed
with earnestness. Now Sam Pepper sprang up, his features full of
baffled passion.
"How dare you talk to me, you miserable pup?" he roared. "I've a
good mind to thrash you well for this! Haven't I clothed and fed you
for years? And this is what I git for it! I've told you the truth about
yourself, only I didn't paint your father as black as I might, not
wishing to hurt your feelings. He was a burglar, and before he was
shot he served two sentences in prison."
"I don't believe it—and I never will," retorted Nelson, but with
quivering lips. "Where was this? Tell me, and I'll soon find out if it is
true."
"I won't tell you a thing more—unless you promise to help me as
you should."
"I won't help you—and that's the end of it."
"You owe me something for keeping you all these years."
"I don't believe you would have kept me if you weren't paid for it."
"I never received a cent—not a penny. You've got to pay me back
somehow."
"Well, I am not going to do it by stealing," answered Nelson
doggedly.
"Then how are you going to do it?"
"I don't know yet."
"I'm going to give this place up soon, and of course the living rooms
will go, too."
"I can find another place to live."
"You want to git out of paying me that five dollars a week, don't
you?" sneered Pepper.
"I can't pay five dollars. But I'll pay what I can. How much do you
think I owe you?"
"A good deal—seeing that I've kept you ten years or longer."
"Didn't my father leave anything?"
"About forty dollars—not enough to keep you three months."
"He hadn't any property?"
"Nothing."
"Well, as I said before, I'll do what I can—when I am able."
"And you won't help me to——" Pepper paused.
"I won't steal—I'll starve first," returned Nelson, and taking up his
hat, he unlocked the door, and walked away from the lunch-room.
CHAPTER VI.
A BOOK AGENT'S TRIALS.
ebookmasss.com