MATLAB An Introduction with Applications 3rd Edition Amos Gilat download
MATLAB An Introduction with Applications 3rd Edition Amos Gilat download
https://ebookfinal.com/download/matlab-an-introduction-with-
applications-3rd-edition-amos-gilat/
https://ebookfinal.com/download/matlab-an-introduction-with-
applications-fourth-edition-amos-gilat/
https://ebookfinal.com/download/matlab-4th-edition-an-introduction-
with-applications-amos-gilat/
https://ebookfinal.com/download/probability-2nd-edition-an-
introduction-with-statistical-applications-john-j-kinney/
https://ebookfinal.com/download/abstract-algebra-an-introduction-with-
applications-2nd-edition-derek-j-s-robinson/
An introduction to programming with Mathematica 3rd
Edition Paul R. Wellin
https://ebookfinal.com/download/an-introduction-to-programming-with-
mathematica-3rd-edition-paul-r-wellin/
https://ebookfinal.com/download/computational-statistics-handbook-
with-matlab-3rd-edition-wendy-l-martinez/
https://ebookfinal.com/download/signals-and-systems-with-matlab-
applications-2nd-edition-steven-t-karris/
https://ebookfinal.com/download/an-introduction-to-numerical-methods-
a-matlab-approach-third-edition-guenther/
https://ebookfinal.com/download/computational-nanotechnology-modeling-
and-applications-with-matlab-r-sarhan-m-musa/
MATLAB An Introduction with Applications 3rd Edition
Amos Gilat Digital Instant Download
Author(s): Amos Gilat
ISBN(s): 9780470108772, 0470108770
Edition: 3rd Edition
File Details: PDF, 6.05 MB
Year: 2008
Language: english
®
MATLAB
An Introduction
with Applications
®
MATLAB
An Introduction
with Applications
Third Edition
Amos Gilat
Department of Mechanical Engineering
The Ohio State University
This book was set in Adobe Framemaker® by the author and printed and bound by Malloy Inc.
The cover was printed by Malloy Inc.
Copyright © 2008 John Wiley & Sons, Inc. All rights reserved.
ISBN 978-0-470-10877-2
10 9 8 7 6 5 4 3 2 1
Preface
MATLAB® is a very popular language for technical computing used by
students, engineers, and scientists in universities, research institutes, and indus-
tries all over the world. The software is popular because it is powerful and easy to
use. For university freshmen in it can be thought of as the next tool to use after the
graphic calculator in high school.
This book was written following several years of teaching the software to
freshmen in an introductory engineering course. The objective was to write a book
that teaches the software in a friendly, non-intimidating fashion. Therefore, the
book is written in simple and direct language. In many places bullets, rather than
lengthy text, are used to list facts and details that are related to a specific topic.
The book includes numerous sample problems in mathematics, science, and engi-
neering that are similar to problems encountered by new users of MATLAB.
This third edition of the book is updated for MATLAB 7.5 (Release 2007b).
Other modifications/changes to this edition are: script files are introduced in
Chapter 1 (this allows students to use script files for solving problems in Chapters
2 and 3), new coverage of the Workspace Window, the save and load commands,
plotting figures with error bars, and instructions for using several Figure Windows
at the same time. Chapter 6 was revised to include coverage on anonymous func-
tions, function functions, function handles, subfunctions and nested functions. In
addition, the end of chapter problems have been revised. There are many new
problems (more than half), and the problems cover a wider range of topics.
I would like to thank several of my colleagues at The Ohio State University.
Professors Richard Freuler, Mark Walter, and Walter Lampert, and Dr. Mike Parke
read sections of the book and suggested modifications. I also appreciate the
involvement and support of Professors Robert Gustafson and John Demel and Dr.
John Merrill from the First-Year Engineering Program at The Ohio State Univer-
sity. Special thanks go to Professor Mike Lichtensteiger (OSU), and my daughter
Tal Gilat (Marquette University), who carefully reviewed the first edition of the
book and provided valuable comments and criticisms. Professor Brian Harper
(OSU) has made a significant contribution to the new end of chapter problems in
the present edition.
I would like to express my appreciation to all those who have reviewed the
first edition of the text at its various stages of development, including Betty Barr,
University of Houston; Andrei G. Chakhovskoi, University of California, Davis;
Roger King, University of Toledo; Richard Kwor, University of Colorado at Colo-
rado Springs; Larry Lagerstrom, University of California, Davis; Yueh-Jaw Lin,
University of Akron; H. David Sheets, Canisius College; Geb Thomas, University
v
vi Preface
of Iowa; Brian Vick, Virginia Polytechnic Institute and State University; Jay
Weitzen, University of Massachusetts, Lowell; and Jane Patterson Fife, The Ohio
State University. In addition, I would like to acknowledge Gladys Soto, Ken San-
tor, and Rachael Leblond, all from John Wiley & Sons, who supported the produc-
tion of the third edition.
I hope that the book will be useful and will help the users of MATLAB to
enjoy the software.
Amos Gilat
Columbus, Ohio
November, 2007
[email protected]
1
2 Introduction
that once these foundations are well understood, the student will be able to learn
advanced topics easily by using the information in the Help menu.
The order in which the topics are presented in this book was chosen care-
fully, based on several years of experience in teaching MATLAB in an introduc-
tory engineering course. The topics are presented in an order that allows the
student to follow the book chapter after chapter. Every topic is presented com-
pletely in one place and then is used in the following chapters.
The first chapter describes the basic structure and features of MATLAB and
how to use the program for simple arithmetic operations with scalars as with a cal-
culator. Script files are introduced at the end of the chapter. They allow the stu-
dent to write, save, and execute simple MATLAB programs. The next two
chapters are devoted to the topic of arrays. MATLAB’s basic data element is an
array that does not require dimensioning. This concept, which makes MATLAB a
very powerful program, can be a little difficult to grasp for students who have only
limited knowledge and experience with linear algebra and vector analysis. The
book is written so that the concept of arrays is introduced gradually and then
explained in extensive detail. Chapter 2 describes how to create arrays, and Chap-
ter 3 covers mathematical operations with arrays.
Following the basics, more advanced topics that are related to script files
and input and output of data are presented in Chapter 4. This is followed by two-
dimensional plotting that is covered in Chapter 5. User-defined functions and
function files are covered next in Chapter 6. The coverage of function files is
intentionally separated from the subject of script files. This has been proven to be
easier to understand by students who are not familiar with similar concepts from
other computer programs. Programming with MATLAB is covered in Chapter 7,
which includes flow control with conditional statements and loops.
The next three chapters cover more advanced topics. Chapter 8 describes
how MATLAB can be used for carrying out calculations with polynomials, and
how to use MATLAB for curve fitting and interpolation. Plotting three-dimen-
sional plots, which is an extension of the chapter on two-dimensional plots, is cov-
ered in Chapter 9. Chapter 10 covers applications of MATLAB for numerical
analysis. It includes solving nonlinear equations, finding a minimum or a maxi-
mum of a function, numerical integration, and solution of first order ordinary dif-
ferential equations. Chapter 11 covers in great detail how to use MATLAB in
symbolic operations.
The Framework of a Typical Chapter
In every chapter the topics are introduced gradually in an order that makes the
concepts easy to understand. The use of MATLAB is demonstrated extensively
within the text and by examples. Some of the longer examples in Chapters 1–3 are
titled as tutorials. Every use of MATLAB is printed in the book with a different
font and with gray background. Additional explanations appear in boxed text with
white background. The idea is that the reader will execute these demonstrations
and tutorials in order to gain experience in using MATLAB. In addition, every
Introduction 3
close), or first selecting on the Desktop Layout in the Desktop menu, and then
Command Window Only from the submenu that opens. How to work in the
Command Window is described in detail in Section 1.2.
Window Purpose
Command Window Main window, enters variables, runs
programs.
Figure Window Contains output from graphic com-
mands.
Editor Window Creates and debugs script and func-
tion files.
Help Window Provides help information.
Launch Pad Window Provides access to tools, demos, and
documentation.
Command History Window Logs commands entered in the Com-
mand Window.
Workspace Window Provides information about the vari-
ables that are used.
Current Directory Window Shows the files in the current direc-
tory.
1.1 Starting MATLAB, MATLAB Windows 7
Figure Window: The Figure Window opens automatically when graphics com-
mands are executed, and contains graphs created by these commands. An example
of a Figure Window is shown in Figure 1-2. A more detailed description of this
window is given in Chapter 5.
When MATLAB is started for the first time the screen looks like that shown in
Figure 1-1 on page 6. For most beginners it is probably more convenient to close
all the windows except the Command Window. (Each of the windows can be
closed by clicking on the button.) The closed windows can be reopened by
selecting them from the Desktop menu. The windows shown in Figure 1-1 can be
displayed by first selecting Desktop Layout in the Desktop menu and then
Default from the submenu. The various windows in Figure 1-1 are docked to the
desktop. The windows can be undocked (become a separate independent window)
by clicking on the button on the upper right-hand corner. An independent win-
dow can be docked back by clicking on the button.
Discovering Diverse Content Through
Random Scribd Documents
that the mother has been following me through the woods ever
since.”
“It is the first of the fold,” said Justus, and Lotta caught up the
screaming morsel to her bosom and hushed it craftily; while, as a
wolf hangs in the field, Matui, who had borne it and in accordance
with the law of her tribe had exposed it to die, panted weary and
footsore in the bamboo-brake, watching the house with hungry
mother-eyes. What would the omnipotent Assistant Collector do?
Would the little man in the black coat eat her daughter alive, as
Athon Dazé said was the custom of all men in black coats?
The evening meal was ended in Dhunni Bhagat’s Chubara, and the
old priests were smoking or counting their beads. A little naked child
pattered in, with its mouth wide open, a handful of marigold flowers
in one hand, and a lump of conserved tobacco in the other. It tried
to kneel and make obeisance to Gobind, but it was so fat that it fell
forward on its shaven head, and rolled on its side, kicking and
gasping, while the marigolds tumbled one way and the tobacco the
other. Gobind laughed, set it up again, and blessed the marigold
flowers as he received the tobacco.
“From my father,” said the child. “He has the fever, and cannot
come. Wilt thou pray for him, father?”
“Surely, littlest; but the smoke is on the ground, and the night-chill
is in the air, and it is not good to go abroad naked in the autumn.”
“I have no clothes,” said the child, “and all to-day I have been
carrying cow-dung cakes to the bazar. It was very hot, and I am very
tired.” It shivered a little, for the twilight was cool.
Gobind lifted an arm under his vast tattered quilt of many colours,
and made an inviting little nest by his side. The child crept in, and
Gobind filled his brass-studded leather water-pipe with the new
tobacco. When I came to the Chubara the shaven head with the tuft
atop and the beady black eyes looked out of the folds of the quilt as
a squirrel looks out from his nest, and Gobind was smiling while the
child played with his beard.
I would have said something friendly, but remembered in time
that if the child fell ill afterwards I should be credited with the Evil
Eye, and that is a horrible possession.
“Sit thou still, Thumbling,” I said as it made to get up and run
away. “Where is thy slate, and why has the teacher let such an evil
character loose on the streets when there are no police to protect us
weaklings? In which ward dost thou try to break thy neck with flying
kites from the house-tops?”
“Nay, Sahib, nay,” said the child, burrowing its face into Gobind’s
beard, and twisting uneasily. “There was a holiday to-day among the
schools, and I do not always fly kites. I play ker-li-kit like the rest.”
Cricket is the national game among the school-boys of the Punjab,
from the naked hedge-school children, who use an old kerosene-tin
for wicket, to the B. A.’s of the University, who compete for the
Championship belt.
“Thou play kerlikit! Thou art half the height of the bat!” I said.
The child nodded resolutely. “Yea, I do play. Perlay-ball. Ow-at!
Ran, ran, ran! I know it all.”
“But thou must not forget with all this to pray to the Gods
according to custom,” said Gobind, who did not altogether approve
of cricket and western innovations.
“I do not forget,” said the child in a hushed voice.
“Also to give reverence to thy teacher, and”—Gobind’s voice
softened—“to abstain from pulling holy men by the beard, little
badling. Eh, eh, eh?”
The child’s face was altogether hidden in the great white beard,
and it began to whimper till Gobind soothed it as children are
soothed all the world over, with the promise of a story.
“I did not think to frighten thee, senseless little one. Look up! Am
I angry? Aré, aré, aré! Shall I weep too, and of our tears make a
great pond and drown us both, and then thy father will never get
well, lacking thee to pull his beard? Peace, peace, and I will tell thee
of the Gods. Thou hast heard many tales?”
“Very many, father.”
“Now, this is a new one which thou hast not heard. Long and long
ago when the Gods walked with men as they do to-day, but that we
have not faith to see, Shiv, the greatest of Gods, and Parbati, his
wife, were walking in the garden of a temple.”
“Which temple? That in the Nandgaon ward?” said the child.
“Nay, very far away. Maybe at Trimbak or Hurdwar, whither thou
must make pilgrimage when thou art a man. Now, there was sitting
in the garden under the jujube trees a mendicant that had
worshipped Shiv for forty years, and he lived on the offerings of the
pious, and meditated holiness night and day.”
“Oh, father, was it thou?” said the child, looking up with large
eyes.
“Nay, I have said it was long ago, and, moreover, this mendicant
was married.”
“Did they put him on a horse with flowers on his head, and forbid
him to go to sleep all night long? Thus they did to me when they
made my wedding,” said the child, who had been married a few
months before.
“And what didst thou do?” said I.
“I wept, and they called me evil names, and then I smote her, and
we wept together.”
“Thus did not the mendicant,” said Gobind; “for he was a holy
man, and very poor. Parbati perceived him sitting naked by the
temple steps where all went up and down, and she said to Shiv,
‘What shall men think of the Gods when the Gods thus scorn their
worshippers? For forty years yonder man has prayed to us, and yet
there be only a few grains of rice and some broken cowries before
him, after all. Men’s hearts will be hardened by this thing.’ And Shiv
said, ‘It shall be looked to,’ and so he called to the temple which was
the temple of his son, Ganesh of the elephant head, saying, ‘Son,
there is a mendicant without who is very poor. What wilt thou do for
him?’ Then that great elephant-headed One awoke in the dark and
answered, ‘In three days, if it be thy will, he shall have one lakh of
rupees.’ Then Shiv and Parbati went away.
“But there was a money-lender in the garden hidden among the
marigolds”—the child looked at the ball of crumpled blossoms in its
hands—“ay, among the yellow marigolds, and he heard the Gods
talking. He was a covetous man, and of a black heart, and he
desired that lakh of rupees for himself. So he went to the mendicant
and said, ‘O brother, how much do the pious give thee daily?’ The
mendicant said, ‘I cannot tell. Sometimes a little rice, sometimes a
little pulse, and a few cowries, and, it has been, pickled mangoes
and dried fish.’”
“That is good,” said the child, smacking its lips.
“Then said the money-lender, ‘Because I have long watched thee,
and learned to love thee and thy patience, I will give thee now five
rupees for all thy earnings of the three days to come. There is only a
bond to sign on the matter.’ But the mendicant said, ‘Thou art mad.
In two months I do not receive the worth of five rupees,’ and he told
the thing to his wife that evening. She, being a woman, said, ‘When
did money-lender ever make a bad bargain? The wolf runs through
the corn for the sake of the fat deer. Our fate is in the hands of the
Gods. Pledge it not even for three days.’
“So the mendicant returned to the money-lender, and would not
sell. Then that wicked man sat all day before him, offering more and
more for those three days’ earnings. First, ten, fifty, and a hundred
rupees; and then, for he did not know when the Gods would pour
down their gifts, rupees by the thousand, till he had offered half a
lakh of rupees. Upon this sum the mendicant’s wife shifted her
counsel, and the mendicant signed the bond, and the money was
paid in silver; great white bullocks bringing it by the cart-load. But
saving only all that money, the mendicant received nothing from the
Gods at all, and the heart of the money-lender was uneasy on
account of expectation. Therefore at noon of the third day the
money-lender went into the temple to spy upon the councils of the
Gods, and to learn in what manner that gift might arrive. Even as he
was making his prayers, a crack between the stones of the floor
gaped, and, closing, caught him by the heel. Then he heard the
Gods walking in the temple in the darkness of the columns, and Shiv
called to his son Ganesh, saying, ‘Son, what hast thou done in
regard to the lakh of rupees for the mendicant?’ And Ganesh woke,
for the money-lender heard the dry rustle of his trunk uncoiling, and
he answered, ‘Father, one half of the money has been paid, and the
debtor for the other half I hold here fast by the heel.’”
The child bubbled with laughter. “And the money-lender paid the
mendicant?” it said.
“Surely, for he whom the Gods hold by the heel must pay to the
uttermost. The money was paid at evening, all silver, in great carts,
and thus Ganesh did his work.”
“Nathu! Oh[=e], Nathu!”
A woman was calling in the dusk by the door of the courtyard.
The child began to wriggle. “That is my mother,” it said.
“Go then, littlest,” answered Gobind; “but stay a moment.”
He ripped a generous yard from his patchwork-quilt, put it over
the child’s shoulders, and the child ran away.
AT HOWLI THANA
There is no getting over the river to-night, Sahib. They say that a
bullock-cart has been washed down already, and the ekka that went
over a half hour before you came has not yet reached the far side. Is
the Sahib in haste? I will drive the ford-elephant in to show him.
Ohe, mahout there in the shed! Bring out Ram Pershad, and if he
will face the current, good. An elephant never lies, Sahib, and Ram
Pershad is separated from his friend Kala Nag. He, too, wishes to
cross to the far side. Well done! Well done! my King! Go half way
across, mahoutji, and see what the river says. Well done, Ram
Pershad! Pearl among elephants, go into the river! Hit him on the
head, fool! Was the goad made only to scratch thy own fat back
with, bastard? Strike! Strike! What are the boulders to thee, Ram
Pershad, my Rustum, my mountain of strength? Go in! Go in!
No, Sahib! It is useless. You can hear him trumpet. He is telling
Kala Nag that he cannot come over. See! He has swung round and is
shaking his head. He is no fool. He knows what the Barhwi means
when it is angry. Aha! Indeed, thou art no fool, my child! Salaam,
Ram Pershad, Bahadur! Take him under the trees, mahout, and see
that he gets his spices. Well done, thou chiefest among tuskers!
Salaam to the Sirkar and go to sleep.
What is to be done? The Sahib must wait till the river goes down.
It will shrink to-morrow morning, if God pleases, or the day after at
the latest. Now why does the Sahib get so angry? I am his servant.
Before God, I did not create this stream! What can I do! My hut and
all that is therein is at the service of the Sahib, and it is beginning to
rain. Come away, my Lord. How will the river go down for your
throwing abuse at it? In the old days the English people were not
thus. The fire-carriage has made them soft. In the old days, when
they drave behind horses by day or by night, they said naught if a
river barred the way, or a carriage sat down in the mud. It was the
will of God—not like a fire-carriage which goes and goes and goes,
and would go though all the devils in the land hung on to its tail.
The fire-carriage hath spoiled the English people. After all, what is a
day lost, or, for that matter, what are two days? Is the Sahib going
to his own wedding, that he is so mad with haste? Ho! Ho! Ho! I am
an old man and see few Sahibs. Forgive me if I have forgotten the
respect that is due to them. The Sahib is not angry?
His own wedding! Ho! Ho! Ho! The mind of an old man is like the
numah-tree. Fruit, bud, blossom, and the dead leaves of all the
years of the past flourish together. Old and new and that which is
gone out of remembrance, all three are there! Sit on the bedstead,
Sahib, and drink milk. Or—would the Sahib in truth care to drink my
tobacco? It is good. It is the tobacco of Nuklao. My son, who is in
service there, sent it to me. Drink, then, Sahib, if you know how to
handle the tube. The Sahib takes it like a Musalman. Wah! Wah!
Where did he learn that? His own wedding! Ho! Ho! Ho! The Sahib
says that there is no wedding in the matter at all? Now is it likely
that the Sahib would speak true talk to me who am only a black
man? Small wonder, then, that he is in haste. Thirty years have I
beaten the gong at this ford, but never have I seen a Sahib in such
haste. Thirty years, Sahib! That is a very long time. Thirty years ago
this ford was on the track of the bunjaras, and I have seen two
thousand pack-bullocks cross in one night. Now the rail has come,
and the fire-carriage says buz-buz-buz, and a hundred lakhs of
maunds slide across that big bridge. It is very wonderful; but the
ford is lonely now that there are no bunjaras to camp under the
trees.
Nay, do not trouble to look at the sky without. It will rain till the
dawn. Listen! The boulders are talking to-night in the bed of the
river. Hear them! They would be husking your bones, Sahib, had you
tried to cross. See, I will shut the door and no rain can enter. Wahi!
Ahi! Ugh! Thirty years on the banks of the ford! An old man am I,
and—where is the oil for the lamp?
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookfinal.com