100% found this document useful (1 vote)
27 views55 pages

Matlab A Practical Introduction To Programming and Problem Solving 1st Edition by Stormy Attaway ISBN 008094325X 9780080943251 Instant Download

The document is a reference for 'Matlab: A Practical Introduction to Programming and Problem Solving' by Stormy Attaway, detailing its content and structure. It includes chapters on MATLAB programming, problem-solving techniques, and various applications of MATLAB. The document also provides links to download the book and other related resources.

Uploaded by

elhagxiloj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
27 views55 pages

Matlab A Practical Introduction To Programming and Problem Solving 1st Edition by Stormy Attaway ISBN 008094325X 9780080943251 Instant Download

The document is a reference for 'Matlab: A Practical Introduction to Programming and Problem Solving' by Stormy Attaway, detailing its content and structure. It includes chapters on MATLAB programming, problem-solving techniques, and various applications of MATLAB. The document also provides links to download the book and other related resources.

Uploaded by

elhagxiloj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Matlab A Practical Introduction to Programming

and Problem Solving 1st edition by Stormy


Attaway ISBN 008094325X 9780080943251 pdf
download
https://ebookball.com/product/matlab-a-practical-introduction-to-
programming-and-problem-solving-1st-edition-by-stormy-attaway-
isbn-008094325x-9780080943251-13458/

Explore and download more ebooks or textbooks


at ebookball.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookball.com
for more options!.

Problem solving methods programming future concepts 1st


Edition by German, Dimitri Ofitserov ISBN 0444544313
9780444544315
https://ebookball.com/product/problem-solving-methods-programming-
future-concepts-1st-edition-by-german-dimitri-ofitserov-
isbn-0444544313-9780444544315-19532/

Programming and Problem Solving With Java 1st Edition by


Nell Dale, Chip Weems, Mark Headington ISBN 0763730696
9780763730697
https://ebookball.com/product/programming-and-problem-solving-with-
java-1st-edition-by-nell-dale-chip-weems-mark-headington-
isbn-0763730696-9780763730697-15872/

Reconstructive Facial Plastic Surgery A Problem Solving


Manual 1st Edition by Hilko Weerda ISBN 9781588906755
1588906752
https://ebookball.com/product/reconstructive-facial-plastic-surgery-a-
problem-solving-manual-1st-edition-by-hilko-weerda-
isbn-9781588906755-1588906752-7704/

CNC Programming Handbook A Comprehensive Guide to


Practical CNC Programming 3rd edition by Peter Smid
9780831192372 0831192372
https://ebookball.com/product/cnc-programming-handbook-a-
comprehensive-guide-to-practical-cnc-programming-3rd-edition-by-peter-
smid-9780831192372-0831192372-18150/
Clinical Problem Solving in Orthodontics and Paediatric
Dentistry Clinical Problem Solving in Orthodontics and
Paediatric Dentistry 1st Edition by Declan Millett,
Richard Welbury 0443072655 978-0443072659
https://ebookball.com/product/clinical-problem-solving-in-
orthodontics-and-paediatric-dentistry-clinical-problem-solving-in-
orthodontics-and-paediatric-dentistry-1st-edition-by-declan-millett-
richard-welbury-0443072655-978-0443072/

A Practical Introduction to Data Structures And Algorithm


Analysis 3rd Edition by Clifford Shaffer

https://ebookball.com/product/a-practical-introduction-to-data-
structures-and-algorithm-analysis-3rd-edition-by-clifford-
shaffer-15310/

Guide to Digital Forensics A Concise and Practical


Introduction 1st Edition by Joakim Kavrestad ISBN
3319674501 9783319674506
https://ebookball.com/product/guide-to-digital-forensics-a-concise-
and-practical-introduction-1st-edition-by-joakim-kavrestad-
isbn-3319674501-9783319674506-16416/

50 Cases in Clinical Cardiology A Problem Solving Approach


1st Edition by Atul Luthra ISBN 9789351521105 9351521109

https://ebookball.com/product/50-cases-in-clinical-cardiology-a-
problem-solving-approach-1st-edition-by-atul-luthra-
isbn-9789351521105-9351521109-4698/

Data Structures and Problem Solving Using C++ 2nd edition


by MALIK ISBN 0324782012 978-0324782011

https://ebookball.com/product/data-structures-and-problem-solving-
using-c-2nd-edition-by-malik-isbn-0324782012-978-0324782011-16350/
Matlab:
A Practical Introduction to
Programming and Problem Solving
Matlab:
A Practical Introduction to
Programming and Problem
Solving
By
Stormy Attaway
College of Engineering, Boston University
Boston, MA

AMSTERDAM • BOSTON • HEIDELBERG • LONDON


NEW YORK • OXFORD • PARIS • SAN DIEGO
SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Butterworth-Heinemann is an imprint of Elsevier
This page intentionally left blank
Butterworth-Heinemann is an imprint of Elsevier
30 Corporate Drive, Suite 400, Burlington, MA 01803, USA
Linacre House, Jordan Hill, Oxford OX2 8DP, UK

Copyright © 2009, Elsevier, Inc. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or by any


means, electronic or mechanical, including photocopy, recording, or any information
storage and retrieval system, without permission in writing from the publisher.

Permissions may be sought directly from Elsevier’s Science & Technology Rights
Department in Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333,
E-mail: [email protected]. You may also complete your request online
via the Elsevier homepage (http://elsevier.com), by selecting “Support & Contact”
then “Copyright and Permission” and then “Obtaining Permissions.”

Library of Congress Cataloging-in-Publication Data


Application submitted

British Library Cataloguing-in-Publication Data


A catalogue record for this book is available from the British Library.

ISBN: 978-0-75-068762-1

For information on all Butterworth-Heinemann publications


visit our Web site at www.elsevierdirect.com

Attribution
MATLAB® and Handle Graphics® are registered trademarks
of The MathWorks, Inc.

Printed in Canada
08╇ 09╇ 10╇╇ 9╇ 8╇ 7╇ 6╇ 5╇ 4╇ 3╇ 2╇ 1
Dedication
This book is dedicated to my two mentors at Boston University: the late
Bill Henneman of the Computer Science Department, and the late Merrill Ebner
of the Department of Manufacturing Engineering.
Stormy Attaway
This page intentionally left blank
Contents

Preface................................................................................................... xiii
Part I  rogramming and Problem Solving
P
Using MATLAB............................................................. 1
Chapter 1 Introduction to MATLAB.................................................... 3
1.1 Getting into MATLAB............................................................. 4
1.2 Variables and Assignment Statements................................. 6
1.2.1 Initializing, Incrementing, and Decrementing............. 8
1.2.2 Variable Names.............................................................. 8
1.3 Expressions........................................................................... 10
1.3.1 The Format Function and Ellipsis.............................. 10
1.3.2 Operators...................................................................... 11
1.3.3 Built-In Functions and Help........................................ 12
1.3.4 Constants...................................................................... 14
1.3.5 Types............................................................................. 14
1.3.6 Random Numbers........................................................ 16
1.4 Characters and Encoding..................................................... 18
1.5 Vectors and Matrices............................................................ 20
1.5.1 Creating Row Vectors.................................................. 21
1.5.2 Creating Column Vectors............................................ 24
1.5.3 Creating Matrix Variables........................................... 24
1.5.4 Dimensions................................................................... 28
1.5.5 Using Functions with Vectors and Matrices.............. 33
1.5.6 Empty Vectors.............................................................. 33

Chapter 2 Introduction to MATLAB Programming.......................... 41


2.1 Algorithms............................................................................. 42
2.2 MATLAB Scripts.................................................................... 43
2.2.1 Documentation............................................................. 45
2.3 Input and Output.................................................................. 46

vii
viii Contents 

2.3.1 Input Function.............................................................. 46


2.3.2 Output Statements: disp and fprintf......................... 48
2.4 Scripts with Input and Output............................................. 53
2.5 Scripts to Produce and Customize Simple Plots................. 54
2.5.1 The Plot Function........................................................ 54
2.5.2 Simple Related Plot Functions.................................... 57
2.6 Introduction to File Input/Output (Load and Save)........... 59
2.6.1 Writing Data to a File................................................... 60
2.6.2 Appending Data to a Data File................................... 61
2.6.3 Reading from a File...................................................... 61
2.7 User-Defined Functions that Return a Single Value.......... 64
2.7.1 Function Definitions.................................................... 65
2.7.2 Calling a Function........................................................ 66
2.7.3 Calling a User-Defined Function from a
Script............................................................................. 67
2.7.4 Passing Multiple Arguments...................................... 67
2.7.5 Functions with Local Variables.................................. 68

Chapter 3 Selection Statements........................................................ 79


3.1 Relational Expressions......................................................... 80
3.2 The if Statement................................................................... 82
3.2.1 Representing Logical True and False........................ 86
3.3 The if-Else Statement........................................................... 87
3.4 Nested if-Else Statements................................................... 88
3.5 The Switch Statement.......................................................... 93
3.6 The Menu Function.............................................................. 96
3.7 The is Functions in MATLAB............................................... 98

Chapter 4 Looping............................................................................ 109


4.1 The for Loop........................................................................ 110
4.1.1 Finding Sums and Products...................................... 111
4.1.2 Combining for Loops with if Statements................. 118
4.1.3 For Loops that Do Not Use the Iterator
Variable in the Action................................................ 119
4.1.4 Input in a for Loop..................................................... 120
4.2 Nested for Loops................................................................. 122
4.2.1 Nested Loops and Matrices...................................... 126
4.2.2 Combining Nested for Loops and if
Statements.................................................................. 130
4.3 Vectorizing........................................................................... 131
4.3.1 Logical Vectors........................................................... 133
4.3.2 Vectors and Matrices as Function Arguments..............140
Contents ix

4.4 While Loops........................................................................ 143


4.4.1 Multiple Conditions in a While Loop....................... 145
4.4.2 Reading from a File in a While Loop........................ 145
4.4.3 Input in a While Loop................................................ 147
4.4.4 Counting in a While Loop......................................... 148
4.4.5 Error-Checking User Input in a While Loop............ 149

Chapter 5 MATLAB Programs......................................................... 161


5.1 More Types of User-Defined Functions............................. 162
5.1.1 Functions that Return More than
One Value................................................................... 162
5.1.2 Functions that Accomplish a Task
Without Returning Values......................................... 166
5.1.3 Functions that Return Values Versus
Printing....................................................................... 167
5.1.4 Passing Arguments to Functions............................. 168
5.2 Matlab Program Organization........................................ 170
5.2.1 Modular Programs...................................................... 170
5.2.2 Subfunctions............................................................... 172
5.3 Application: Menu-Driven Modular Program................... 174
5.4 Variable Scope..................................................................... 182
5.4.1 Persistent Variables................................................... 184
5.5 Debugging Techniques...................................................... 185
5.5.1 Types of Errors........................................................... 186
5.5.2 Tracing........................................................................ 188
5.5.3 Editor/Debugger........................................................ 189
5.5.4 Function Stubs........................................................... 190

Chapter 6 String Manipulation........................................................ 197


6.1 Creating String Variables................................................... 198
6.1.1 Strings as Vectors...................................................... 198
6.2 Operations on Strings......................................................... 200
6.2.1 Concatenation............................................................ 200
6.2.2 Creating Customized Strings.................................... 202
6.2.3 Removing Whitespace Characters........................... 206
6.2.4 Changing Case........................................................... 207
6.2.5 Comparing Strings..................................................... 207
6.2.6 Finding, Replacing, and Separating
Strings......................................................................... 209
6.2.7 Evaluating a String.................................................... 213
6.3 The is Function for Strings................................................. 214
6.4 Converting between String and Number Types.............. 215
x Contents

Chapter 7 Data Structures: Cell Arrays and Structures................ 223


7.1 Cell Arrays........................................................................... 224
7.1.1 Creating Cell Arrays.................................................. 224
7.2 Structures............................................................................ 229
7.2.1 Creating and Modifying Structure
Variables..................................................................... 229
7.2.2 Passing Structures to Functions............................... 231
7.2.3 Related Structure Functions...................................... 232
7.2.4 Vectors of Structures................................................. 234
7.2.5 Nested Structures...................................................... 241
7.2.6 Vectors of Nested Structures.................................... 243

Chapter 8 Advanced File Input and Output................................... 253


8.1 Lower Level File I/O Functions.......................................... 254
8.1.1 Opening and Closing a File....................................... 254
8.1.2 Reading from Files..................................................... 255
8.1.3 Writing to Files........................................................... 262
8.1.4 Appending to Files.................................................... 264
8.2 Writing and Reading Spreadsheet Files........................... 264
8.3 Using MAT-Files for Variables........................................... 266
8.3.1 Writing Variables to a File......................................... 266
8.3.2 Appending Variables to a MAT-File......................... 267
8.3.3 Reading from a MAT-File........................................... 267

Chapter 9 Advanced Functions....................................................... 273


9.1 Anonymous Functions........................................................ 273
9.2 Uses of Function Handles................................................... 275
9.2.1 Function Functions.................................................... 276
9.3 Variable Numbers of Arguments....................................... 278
9.3.1 Variable Number of Input Arguments...................... 279
9.3.2 Variable Number of Output Arguments................... 280
9.4 Nested Functions................................................................ 284
9.5 Recursive Functions........................................................... 287

Part II Applications. ............................................................. 295


Chapter 10 MATLAB Plots................................................................. 297
10.1 Plot Functions.................................................................... 297
10.1.1 Matrix of Plots........................................................ 298
10.1.2 Plot Types............................................................... 299
10.2 Animation.......................................................................... 302
10.3 Three-Dimensional Plots.................................................. 303
10.4 Customizing Plots............................................................. 304
Contents xi

10.5 Graphics Properties.......................................................... 306


10.6 Plot Applications............................................................... 308
10.6.1 Plotting from a Function........................................ 308
10.6.2 Plotting File Data.................................................... 309

Chapter 11 Solving Systems of Linear Algebraic Equations.......... 321


11.1 Matrix Definitions............................................................. 322
11.1.1 Matrix Properties................................................... 322
11.1.2 Square Matrices...................................................... 324
11.1.3 Matrix Operations.................................................. 328
11.1.4 Matrix Multiplication............................................. 330
11.1.5 Vector Operations.................................................. 334
11.2 M
 atrix Solutions to Systems of Linear
Algebraic Equations......................................................... 336
11.2.1 Solving 2 ´ 2 Systems of Equations...................... 338
11.2.2 Gauss, Gauss-Jordan Elimination......................... 341
11.2.3 Reduced Row Echelon Form................................. 347
11.2.4 Finding a Matrix Inverse by Reducing
an Augmented Matrix............................................ 348
11.3 Symbolic Mathematics...................................................... 348
11.3.1 Symbolic Variables and Expressions.................... 349
11.3.2 Simplification Functions........................................ 350
11.3.3 Displaying Expressions......................................... 351
11.3.4 Solving Equations.................................................. 352

Chapter 12 Basic Statistics, Searching, and Sorting........................ 361


12.1 Statistical Functions......................................................... 362
12.1.1 Mean........................................................................ 363
12.1.2 Variance and Standard Deviation......................... 366
12.1.3 Mode........................................................................ 367
12.1.4 Median.................................................................... 368
12.2 Set Operations................................................................... 368
12.3 Sorting................................................................................ 372
12.3.1 Sorting Vectors of Structures................................ 374
12.3.2 Sorting Strings........................................................ 377
12.4 Indexing............................................................................. 379
12.4.1 Indexing into Vectors of Structures...................... 381
12.5 Searching........................................................................... 382
12.5.1 Sequential Search................................................... 382
12.5.2 Binary Search......................................................... 383

Chapter 13 Sights and Sounds.......................................................... 393


13.1 Sound Files........................................................................ 393
xii Contents

13.2 Introduction to Handle Graphics..................................... 395


13.2.1 Graphics Objects and Their Properties................ 395
13.3 Image Processing.............................................................. 400
13.4 Introduction to Graphical User Interfaces...................... 405

Chapter 14 Advanced Mathematics................................................. 421


14.1 Fitting Curves to Data...................................................... 421
14.1.1 Polynomials............................................................. 422
14.1.2 Curve Fitting.......................................................... 423
14.1.3 Interpolation and Extrapolation............................ 423
14.1.4 Least Squares......................................................... 426
14.2 Complex Numbers............................................................ 429
14.2.1 Equality for Complex Numbers............................. 431
14.2.2 Adding and Subtracting Complex Numbers.........431
14.2.3 Multiplying Complex Numbers............................. 432
14.2.4 Complex Conjugate and Absolute Value............. 433
14.2.5 Complex Equations Represented as
Polynomials............................................................. 433
14.2.6 Polar Form............................................................... 434
14.2.7 Plotting.................................................................... 434
14.3 Calculus: Integration and Differentiation....................... 435
14.3.1 Trapezoidal Rule..................................................... 435
14.3.2 Differentiation........................................................ 437
14.3.3 Calculus in Symbolic Math Toolbox...................... 438

Index......................................................................................................... 447
Preface

Motivation
The purpose of this book is to teach basic programming concepts and skills
needed for basic problem solving, all using MATLAB® as the vehicle. MATLAB
is a powerful software package that has built-in functions to accomplish a
diverse range of tasks, from mathematical operations to three-dimensional
imaging. Additionally, MATLAB has a complete set of programming constructs
that allows users to customize programs to their own specifications.
There are many books that introduce MATLAB. There are two basic flavors
of these books: those that demonstrate the use of the built-in functions in
MATLAB, with a chapter or two on some programming concepts, and those that
cover only the programming constructs without mentioning many of the built-
in functions that make MATLAB efficient to use. Someone who learns just the
built-in functions will be well-prepared to use MATLAB, but would not under-
stand basic programming concepts. That person then would not be able to learn
a language such as C++ or Java without taking another introductory course, or
reading another book, on the programming concepts. Conversely, anyone who
learns only programming concepts first (using any language) would tend to
write highly inefficient code using control statements to solve problems, not
realizing that in many cases these are not necessary in MATLAB.
This book instead takes a hybrid approach, introducing both the programming
and the efficient uses. The challenge for students is that it is nearly impossi-
ble to predict whether they will in fact need to know programming concepts
later on or whether a software package such as MATLAB will suffice for their
careers. Therefore, the best approach for beginning students is to give them
both—the programming concepts and the efficient built-in functions. Since
MATLAB is very easy to use, it is a perfect platform for this approach to �teaching
�programming and problem solving.
Since programming concepts are critically important to this book, emphasis
is not placed on the time-saving features that evolve with every new MATLAB
release. For example, in current versions of MATLAB statistics on variables are xiii
xiv Preface

available readily in the Workspace window. This is not shown in any detail in
the book, since whether this feature is available depends on the version of the
software, and because of the desire to explain the concepts in the book.

Key Features
Side-by-Side Programming Concepts and Built-In
Functions
The most important, and unique, feature of this book is that it teaches program-
ming concepts and the use of the built-in functions in MATLAB side by side.
It starts with basic programming concepts such as variables, assignments, input/
output, selection, and loop statements. Then, throughout the rest of the book,
often a problem will be introduced and then solved using the “Â�programming
concept” and also using the “efficient method.”

Systematic Approach
Another key feature is that the book takes a very systematic, step-by-step
approach, building on concepts throughout the book. It is very tempting in a
MATLAB text to show built-in functions or features early on with a note that
says “we’ll do this later.” This book does not do that; all functions are covered
before they are used in examples. Additionally, basic programming concepts
will be explained carefully and systematically. Very basic concepts such as loop-
ing to calculate a sum, counting in a conditional loop, and error-checking are
not found in many texts but will be covered here.

File Input/Output
Many applications in engineering and the sciences involve manipulating large
data sets that are stored in external files. Most MATLAB texts at least mention
the save and load functions, and in some cases also some of the lower level
file input/output functions. Since file input and output is so fundamental to
so many applications, this book will cover several low-level file input/output
functions, as well as reading from and writing to spreadsheet files. Later chap-
ters will also deal with audio and image files. These file input/output concepts
are introduced gradually: first load and save in Chapter 2, then lower level
functions in Chapter 8, and finally sound and images in Chapter 13.

User-Defined Functions
User-defined functions are a very important programming concept, and yet
many times the nuances and differences between types of functions, function
calls versus function headers, and so on, can be very confusing to beginning
programmers. Therefore these concepts are introduced gradually. First, �arguably
Random documents with unrelated
content Scribd suggests to you:
A couple minutes more,
In hopes to see the worms come out
Which he was rapping for;
But after he went b-r-r-r! and b-r-r-r!
A while, he flew away,
And Johnny said he guessed there were
No worms at home that day.

So then we hurried up, and ran


As fast as we could run,
To get there just as school began.
And just when it’s begun
I had to run back to the tree
To get my slate and rule;
And yet the teacher cannot see
Why boys are late for school.
A PRESENT FOR LITTLE BOY BLUE
O UR Neighbor, he calls me his Little Boy Blue
Whenever he goes by our yard;
And he says, “Good-morning” or “How-do-you-do?”
But sometimes he winks awful hard.
I guess he don’t know what my name really is,
Or else he forgot, if he knew;
And my! You would think I am really part his—
He calls me his Little Boy Blue!

Our Neighbor, he told me that Little Boy Blue


Once stood all his toys in a row,
And said, “Now, don’t go till I come back for you”—
But that was a long time ago.
And one time, at Christmas, when I had a tree,
He brought me a sled, all brand-new,
And smiled when he said it was partly for me
And partly for Little Boy Blue.

Our Neighbor, he’s not going to have any tree,


So he says the best he can do
Is try to get something to partly give me
And partly give Little Boy Blue,
Because, if he’s here, it would make him so glad,
And he said he knew it was true
That ever and ever so many folks had
A boy just like Little Boy Blue.

Our Neighbor, he calls me his Little Boy Blue,


And said he would like to help trim
Our tree when it came—he would feel that he knew
It was partly for me and for him.
He said he would fix it with lights and wax flowers,
With popcorn and berries—you see,
He’d like to come over and help to trim ours—
He’s not going to have any tree!
THE EVOLUTION OF AN ADOPTION
H E’S ’ist a little orfant boy
W’at goes to school with me;
An’ ain’t got any parents ’cuz
His folks is dead, you see.
An’ w’en he sees my toys an’ things—
My, but his eyes ’ist shine;
An’ he ain’t got no marbles, so
I give him half of mine.

An’ once it’s orful stormy w’en


It’s noon an’ he can’t go
Back where he works for board an’ clo’es
To get his lunch, an’ so
I had some san’wiches an’ things
’At he thought was ’ist fine,
An’ ’cuz he didn’t have no lunch
I give him half of mine.

An’ once w’en we went down to fish


He come along with me,
An’ w’en we’re there says he ’ist wish
’At he could fish. You see
He’s orful poor an’ brought a pole
But didn’t have a line,
An’ w’en I saw how bad he felt
I give him half of mine.

An’ one time I ’ist told my Ma


How he don’t have much fun
’Cuz he ain’t got no Ma or Pa
Or Aunt or any one.
An’ ’en I told her how I thought
’At it would be ’ist fine
’Cuz he ain’t got no mother if
I’d give him half of mine.

He ain’t my brother, really true,


He’s ’ist an orfant so
He s ist an orfant, so
My Ma she took him, ’cuz she knew
He had no place to go.
I’m awful glad we got him an’
My Pa thinks it ’ist fine—
He didn’t have no mother, so
I give him half of mine.
SOME GIRLS THAT MAMMA KNEW
M Y Mamma says ’at once ’ere was
A little girl she knew
Who went an’ cried, an’ ’ist because—
Because she wanted to;
An’ w’ile her face was all askew
The wind changed, so they say,
An’ Mamma told me ’at it’s true,
Her face ’ist staid ’at way!
An’ w’en she told me ’at, w’y nen
I said I’ll never cry again.

My Mamma said ’at once she heard


A little girl like me
Tell ’ist one fib, an’ says, my word!
Her Mamma looked to see
W’ere was her tongue, an’ goodness me!
Her mouth was ’ist all bare,
An’ w’ere her tongue ’ud ought to be
There wasn’t any there!
An’ w’en she told me ’at, w’y nen
I said I’ll never fib again!

My Mamma knew a little girl


’At used to run away
W’en her dear mother ’d start to curl
Her hair; an’ one fine day
Some gypsies took her off, somehow,
An’ stole her from her home,
An’ my! Her hair is awful now,
’Cause gypsies never comb!
An’ since she told me ’at, w’y nen
I never runned away again!

An’ never don’t make fun, she says,


Of folks ’at’s blind or lame,
Or got red hair or warts, unless
You want to be the same.
’Cause lots of times it happens so
Cause lots of times it happens so,
An’ surely if you do,
You never, never, never know
What’s going to happen you.
An’ since she told me ’at, w’y nen
I never don’t make fun again.
GONE

H E fell in a puddle and muddied his dress,


He struck little Bob with a hammer, I guess;
He cut sister’s curls with a big pair of shears
And left ragged edges down over her ears;
He muddied the floor that was just scrubbed so clean,
He lighted a match near the canned gasoline,
He broke all his soldiers and smashed all his toys,
And yet we forgave him, for boys will be boys.

He singed the cat’s whiskers and cut off its tail


And then turned it loose with its discordant wail;
He dropped bread and jelly upon a big chair
And thought of it only when Aunty sat there;
He sheared the pet poodle one midwinter day,
His father is frantic, his mother is gray,
His Aunt and his Grandma protest at his noise,
And then all forgive him, for boys will be boys.

He clamors for cookies, for jelly and jam,


He shuts ne’er a door, but he gives it a slam,
He dabbles in paint, be it red, blue or green,
He loves to play hob with the sewing machine;
And then—well, he’s gone into trousers and vests,
For years must be passing and time never rests,
And some day we look at a picture—and then
We wish—strange it is—that we had him again.
THE NEIGHBOR’S BOYS

S OMEBODY shot our cat’s eye out,


An’ stole our gate an’ just about
Scared Aunt Sophia Jane to death
So’s she could hardly get her breath,
By puttin’ on some sheets, all white,
’At just gave her a turble fright,
An’ who on earth do you suppose
Put on them big, white ghostes’ clothes
An’ made that turble screechy noise?—
The neighbor’s boys!

An’ every night it’s dark, you know,


Somebody plays some tick-tack-toe
On folkeses’ windows what’s a-scared,
An’ just as if they never cared
If they get caught or not, an’ when
You’re gone to bed they come again
Until you’re just so nervous you
Don’t hardly know just what to do;
An’ who makes such a scary noise?
The neighbor’s boys.

An’ ’en somebody tears your clothes


An’ skins your face an’ hurts your nose
Until it bleeds, an’ then your Ma
Says ’at she never, never saw
THE NEIGHBOR’S BOYS
S UCH heathen youngsters, an’ they come
An’ break your sled an’ pound your drum
Until it busts, an’ wont go ’way,
It ain’t no matter what you say,
An’ they’re the ones ’at break your toys—
The neighbor’s boys.

An’ my, it’s funny, ’cause, you know


You ain’t the only ones ’at’s so.
’Cause all the next door neighbors say
It seems e’zactly the same way,
An’ when their boys gets hurted so’s
It gives ’em turble bloody nose,
An’ some one shoots their cat’s eye out,
An’ plays tick-tack, they know about
Who does it an’ who makes the noise—
The neighbor’s boys!
A QUIET AFTERNOON

M Y Mamma, she did go to call about an hour ago,


An’ said if I ain’t bad at all an’ stayed at home with Flo,
Which is the maid that cooks for us, she’d bring me something good,
But if I’m one bit misschefuss she didn’t think she would.

An’ my! I’m still, ’ist like a mouse. I never went outdoors,
But ’ist sat down, inside the house, an’ took her bureau drawers
An’ emptied ’em ’ist one by one, an’ w’en they’re emptied ’en
I ’ist looked through what’s there for fun an’ put ’em back again!

An’ ’en I found the nicest ink, an’ one of ’em was red,
An’ one was black an’ ’en I think I spilt some on the bed,
But my! I wiped it up, ’ist so, an’ sopped it with a quilt
So clean you wouldn’t hardly know it’s ever once been spilt.

Well, ’en I looked up on the shelf an’ found her scissors there
An’ got ’em down all by myself an’ cut off all my hair,
’Tuz I don’t think it’s nice for girls like me ’at’s almost through
First reader to wear such a curls like Mamma makes me do.

’En Flo gave me some bread and jam, ’tuz I ’ist cried and cried
’Ist tuz I’m hungry now, I am, an’ ’en I went inside,
An’ maybe I did let it lay around the room somewhere,
’Tuz Flo came in to watch me play and squoshed it on a chair.

An’ after while I wish my Ma would ’ist come back, she would,
’Tuz my, I’m gettin’ drefful tired of simply bein’ good.
My eyes, ’ey’re ’ist so full of sand an’ heavy, ’ist like lead,
Oh-oh! I dess it’s Sleepyland! I dess I’ll go to bed!
THE OWNERLESS TOYS
O UR Uncle Bill’s attic is half full of toys,
With some that are almost brand-new;
He’s got things up there for most all kinds of boys
From ten years old clear down to two.
And one day he gave me some books from up there
Like boys had a long time ago;
And I asked if the boy they belong to would care,
But he just sort of smiled and said no.

Sometimes we would go in his attic to play


And find such a lot of fine things,
A whole lot of picture books all piled away
And tops that were wound up with strings.
And Uncle Bill told us to use what was there
Just as if it was ours, and we’d go,
But we’d ask if the boy they belong to would care,
And he just sort of smiled and said no.

And my! There were sleds with their runners all rust,
And five or six good pairs of skates,
Some old-fashioned toys that were covered with dust,
And fishlines and schoolbooks and slates,
Which Uncle Bill told us we fellows might share,
But always put back when we go;
And we thought that the boy they belong to might care,
But he just sort of smiled and said no.

And the boy they belong to, I guess, was away.


At least, we all thought he must be;
For all through the house they could hear us at play,
But he never came up there to see.
And we would pile everything back up with care
And ask Uncle Bill when we’d go
If the boy they belong to would know we’d been there,
But he just sort of smiled and said no.

Our Uncle Bill’s attic is half full of toys,


Some old ones and some almost new;
Some old ones and some almost new;
He’s got things up there for most all kinds of boys
From ten years old clear down to two.
And often when we boys go up there to play
We ask Uncle Bill when we go
If the boy they belong to will be back that day,
And he smiles sort of sad and says no.
THE STRANGER
S ERIOUS-minded little maid,
Wondering and half afraid,
Half inclined to speak with me,
Half disposed to let me be;
Hesitating yet, and shy,
Half a twinkle in your eye,
Half in doubt and half in fear,
Staying neither far nor near.

How I wonder what you see


With those eyes that question me;
What the instinct bids you know
If I may be friend or foe;
Fawnlike, full of grace and sweet,
Ready with fast-flying feet
In the orchard’s deepest shade
To find cover, little maid.

Grave and curious little lass,


Like a wild bird in the grass,
Still intently watching me,
With your wings half spread, to see
If my smile bodes good or ill,
Willing to make friends and still
Undecided if to stay
Here and near or fly away.

Serious-minded little maid,


When, with smiles and unafraid,
O’er the lawn you come to me,
Stranger to you though I be,
When your curious eyes have tried
Soul with mine and, satisfied,
Looked still into mine and smiled,
Blessed am I, little child.

Blessed am I to be just
Worthy of your childish trust
Worthy of your childish trust,
More than conqueror of kings
When the wild bird of your wings
Bids you fly not forth but see
Something tender, kind, in me;
Oh, the gladness you have laid
At my heart’s gate, little maid!
IN VACATION TIME

T HERE’S a hole in his hat with the hair sticking through,


And a toe that peeps out from a hole in his shoe;
There’s a patch in his trousers, a darn in his hose,
And a freckle that tilts on the bridge of his nose;
But oh, in his heart there’s the glimmer and shine
Of a sun that I wish could be shining in mine.

There’s a smudge on his face that is dusty and dark,


But a song in his heart like the song of a lark;
There’s a rent in his coat where the lining shows through,
But the whistle he tunes to the wild bird is true;
And, oh, in his heart, with a sparkle like wine,
Is a gladness I wish could be sparkling in mine.

There’s an imp in his hair that may keep it awry,


But a twinkle so rare in the blue of his eye;
There’s an uneven slant of his trousers, made fast
With a nail through their tops, for a button won’t last;
But deep in his heart lies a spring cool and fine
Of good cheer that I wish could be bubbling in mine.

There’s a tan on his cheek where the flush of health glows,


And the skin has all peeled from the tip of his nose;
His pockets are bulged with tops, marbles and strings,
With jack-knives and other uncountable things;
But the brooks and the woods bring a music divine
To his ears that I wish they were bringing to mine.
BEREAVED
G UESS he must be awful old; we had him years and years,
And he’s so old the ends were worn all off of both his ears.
He couldn’t hardly eat, because his teeth were all worn out,
And all his legs got stiff, so he could hardly drag about.
One day he lay down by the house, right near the cellar door,
And gasped and gasped for breath, until he couldn’t any more;
So I went out and patted him, and when he heard me call
He looked at me and wagged his tail, which died the last of all.

My! he was black and curly once, when he was new and young,
And he would open up his mouth at us and curl his tongue,
Just like he laughed, and play with us; and he would go into
The creek, and bring our hats to us, or anything we threw.
In winter we would hitch him up, and he would haul our sled,
And walk or trot or run with it, or anything we said;
So when he wagged his tail at me I laid him right beside
The cellar door, and then I went behind the barn and cried.

He was a friend of all the boys, and when they came to play
He’d wag his tail and bark and look at them the smartest way;
And he’d pretend to bite at them and nip their pants, but he
Would never bite, ’cause he was just as kind as he could be.
And Henry Watson looked at him beside the cellar door,
And said, “He’ll never haul us boys on our sled any more.”
He turned his ears back straight and nice; he liked him awful well;
Because he had tears in his eyes, and then a big one fell.

So after while we got a spade, and Billy Gibson came,


And Tommy Dean and Eddie Brink, and they all felt the same.
We dug some turf up in the yard, right underneath a tree,
And laid him in and left him there, all covered carefully;
It was an awful solemn day for all of us, for though
He’d got worn out and couldn’t eat, we boys all liked him so;
And Eddie Brink, he didn’t think the Lord would really care
If we boys sang a hymn for him and said a little prayer.

My! it was awful sad that day! And Tommy said he thought
We wouldn’t play that afternoon because he’d rather not
We wouldn t play that afternoon, because he d rather not.
And Mamma made some nice ice-cream, which cheered us up, but when
We wanted her to eat she said she couldn’t eat just then.
And Amy Robbins heard of it, and brought some leaves and flowers
To scatter over him, because he was a friend of ours;
And I told her I patted him, and when he heard me call
He looked at me and wagged his tail, which died the last of all.
TWO LITTLE MAIDS

L ITTLE Miss Nothing-to-do


Is fretful and cross and so blue,
And the light in her eyes
Is all dim when she cries
And her friends, they are few, Oh, so few!
Her dolls, they are nothing but sawdust and clothes,
Whenever she wants to go skating it snows,
And everything’s criss-cross, the world is askew!
I wouldn’t be Little Miss Nothing-to-do
Now, true,
I wouldn’t be Little Miss Nothing-to-do
Would you?

Little Miss Busy-all-day


Is cheerful and happy and gay
And she isn’t a shirk
For she smiles at her work
And she romps when it comes time for play.
Her dolls, they are princesses, blue-eyed and fair,
She makes them a throne from a rickety chair,
And everything happens the jolliest way,
I’d rather be Little Miss Busy-all-day,
Hurray,
I’d rather be Little Miss Busy-all-day,
I say.
A NEW CHRISTMAS CAROL
C OME, children, I’ll tell you a wonderful tale,
I learned it one night in a dream;
The snow lay all white and the full moon shone pale,
The housetops about were agleam;
I’d fallen asleep in my big easy chair,
I heard a gruff voice in my ear,
I knew that Saint Nicholas surely was there
And listened to see what I’d hear.

“Come, follow with me,” were the first words he said,


“I’m off for my Palace of Snow;
I’ve emptied my pack of each doll, toy and sled,
It’s time for old Santa to go.
But, Oh, I’ve a treat waiting for me tonight,
I’ve planned it for years in my mind;
Come, follow with me, while the moon is still bright”—
I rose and we sped like the wind.

We flew like a flash to the Palace of Snow,


By hilltop and valley and plain,
Nor ever I will be permitted, I know,
To make such a journey again;
And there in the warmest and cosiest nook
He bade me sit down while he dressed
In robes of rich scarlet and said to me: “Look!
Here come the Child Hosts of the Blest.”

A flash of his eye and my wonderment grew,


A word and a wave of his rod,
Forth came Orphan Annie and Little Boy Blue,
And Wynken and Blynken and Nod.
With Alice from Wonderland, blue-eyed and fair,
Tom Tucker—Jack Horner with him,
And Oh, at the last, can you guess who was there?—
Poor Topsy and Dear Tiny Tim!

He spread out his arms and they passed one by one,


Each laden with treasures and toys
Each laden with treasures and toys,
And never or ever a night of such fun
Was passed by such girls and such boys;
Nor ever will Annie be orphan with him,
He told me, and Little Boy Blue
Came back from the shadows all misty and dim,
So glad that the toy dog was true.

And always and always he’ll keep them with him,


He told me, through all of the years,
Poor Topsy and Alice and Dear Tiny Tim,
And Topsy will know no more tears.
But tales of them all he will bring Christmas night,
The brightest and sweetest and best,
That our boys and girls may know joy and delight
From Santa’s Child Hosts of the Blest!
THE RECONCILIATION OF PA

M Y Pa, he’s disappointed tuz I ain’t a boy. ’At is


He ain’t now but he used to was. He likes me tuz I’m his
An’ buys me lots of toys an’ things; but w’en I first begun
Ma said he’s awful fond of boys an’ ’ist wished I was one.
But now he don’t care any more, tuz I’m growed up so nice
He likes me better ’n before, an’ there ain’t any price
’At you could offer him for me an’ he would take it, tuz
I’m so much nicer, don’t you see, ’an my Pa thought I was.

W’en I’m come first my Mamma said ’at he ’ud ruther I


’Ud been a boy the stork ’ud brought; she says she don’t see w’y,
Tuz she ’ist thinks ’at little girls are awful nice, an’ w’en
You wash ’eir face an’ brush ’eir turls, ’ey’re nicer ’n ever ’en.
But he is disappointed tuz at first he didn’t know
How rilly truly nice I was; but w’en I came to grow
He wouldn’t take the world for me, so he told Ma, ’ist tuz
I’m so much nicer, don’t you see, ’an my Pa thought I was.

An’ my Ma says ’at if I grow up ’ist so nice an’ sweet


As I am now, my Pa ’ll know ’at stork was hard to beat;
An’ he won’t never wish again ’at I’m a boy, ’ist tuz
He’ll know how sweet I am, an’ ’en he’s glad I’m w’at I was;
Tuz boys are awful nice at first, ’at is, you think they are,
An’ w’en they’re big they’re ’ist the worst! An’ girls is better far,
An’ Ma says if you want ’em sweet, ’ist sweet as sweet can be,
You’ll find it awful hard to beat a little girl like me.
A WORLD WITHOUT CARE
T HERE’S a song that is sweet
And a whistle that’s clear;
There’s a dog at his feet
And another one near;
There’s a fish in the brook
And a line that is whirled,
There’s a worm on a hook—
All is well with the world.

There’s a rock that has slipped


From the bank to the brink,
There’s a hat that is dipped
In the brook for a drink;
There’s a line that is cast
Where an eddy is swirled,
There’s a fat perch caught fast—
All is well with the world.

There’s a heartful of joy


And a handful of fish,
There’s a satisfied boy
Glad as gladness could wish;
There are leaves green and cool
Where the fat perch is curled,
There are more in the pool—
All is well with the world.

There’s an angler come home


At the close of the day,
There’s a chirp in the gloam
Of a whistle so gay,
There’s a monster near-caught
Where the foam danced and curled,
There’s a meal piping hot—
All is well with the world.
RIGHT AFTER SCHOOL
I KNOW where’s the happiest Kingdom in all of the world I have seen,
No bigger than Grandfather’s orchard, and all of it’s grassy and green,
It has but a few dozen people, the happiest youngsters alive,
’Tis ruled by a Princess of seven, and one little soldier of five;
There’s one little crown made of daisies and one little sword made of tin,
And one little drum that goes rolling betimes with a terrible din;
You’d think that a war was beginning by all of the noise that is made,
When, really, it’s only the army declaring itself on parade.

In all of the bounds of the Kingdom there isn’t a book or a chore;


The reign of the Princess begins when the schoolday is over at four;
Her castle with turrets and towers is right near a big apple tree.
It isn’t a visible castle, but if you were there you could see;
And if you should chance to be looking that way when the proud Princess
comes,
You’d see a bold soldier go marching and hear a fierce rattle of drums,
You’d see loyal subjects and happy, with no thought of table or rule,
You’d want to belong to the Kingdom—the Kingdom of Right-After-School!

It’s really a well-behaved people—they put by their slates and their books
And have little use for an army except as a matter of looks;
But nobody dares say addition, division, subtraction—if you
Should mention a one of these subjects the tin sword would run you right
through!
But you can say swinging or jumping or follow-my-leader, nor fear
You break any law of the country—and if from your window you hear
A chorus of voices or laughter, when evening grows twilit and cool,
You’ll know ’tis the music they make in the Kingdom of Right-After-
School!

There’s not a sad heart in the Kingdom, nor ever or ever a tear,
And all of the sorrows of schooldays are lost or forgotten in here;
The make-believe fairies go singing with songs that are wondrously sweet;
The green turf is flecked with white dresses and patters with fast-flying feet;
It’s just between School’s-Out and Teatime—an hour or so of the day,
And often I see them there crowning with daisies the Princess of Play;
Then some one calls: “Supper-time, children!”—when evening grows twilit
and cool
and cool.
It fades from my sight till tomorrow—the Kingdom of Right-After-School!
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookball.com

You might also like