100% found this document useful (7 votes)
32 views

MATLAB Programming with Applications for Engineers 1st Edition Edition Stephen J. Chapman pdf download

Ebook download

Uploaded by

rohmahshingy
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 (7 votes)
32 views

MATLAB Programming with Applications for Engineers 1st Edition Edition Stephen J. Chapman pdf download

Ebook download

Uploaded by

rohmahshingy
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/ 64

MATLAB Programming with Applications for

Engineers 1st Edition Edition Stephen J. Chapman


pdf download

https://ebookname.com/product/matlab-programming-with-
applications-for-engineers-1st-edition-edition-stephen-j-chapman/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

MATLAB Programming for Engineers 3rd Edition Stephen J.


Chapman

https://ebookname.com/product/matlab-programming-for-
engineers-3rd-edition-stephen-j-chapman/

C Programming for Scientists and Engineers with


Applications 1st Edition Rama Reddy

https://ebookname.com/product/c-programming-for-scientists-and-
engineers-with-applications-1st-edition-rama-reddy/

Introduction to MATLAB for Engineers 3rd Edition


William J. *Palm

https://ebookname.com/product/introduction-to-matlab-for-
engineers-3rd-edition-william-j-palm/

Clinical Psychology in Practice 1st Edition Susan


Llewelyn

https://ebookname.com/product/clinical-psychology-in-
practice-1st-edition-susan-llewelyn/
Handbook of Pediatric Obesity Clinical Management 1st
Edition Melinda S. Sothern

https://ebookname.com/product/handbook-of-pediatric-obesity-
clinical-management-1st-edition-melinda-s-sothern/

p Adic Functional Analysis proceedings of the sixth


international conference 1st Edition A.K. Katsaras

https://ebookname.com/product/p-adic-functional-analysis-
proceedings-of-the-sixth-international-conference-1st-edition-a-
k-katsaras/

Blowing Agents and Foaming Processes 2012 1st Edition


Smithers Rapra

https://ebookname.com/product/blowing-agents-and-foaming-
processes-2012-1st-edition-smithers-rapra/

Engineering economy 16th ed Edition Sullivan

https://ebookname.com/product/engineering-economy-16th-ed-
edition-sullivan/

Warehouse Management Automation and Organisation of


Warehouse and Order Picking Systems Intralogistik 1st
Edition Michael Ten Hompel

https://ebookname.com/product/warehouse-management-automation-
and-organisation-of-warehouse-and-order-picking-systems-
intralogistik-1st-edition-michael-ten-hompel/
Sebastian Ephemera 01 Anne Bishop

https://ebookname.com/product/sebastian-ephemera-01-anne-bishop/
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page ii

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page i

MATLAB®
Programming
with Applications
for Engineers

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page ii

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page iii

MATLAB®
Programming
with Applications
for Engineers
First Edition

Stephen J. Chapman
BAE Systems Australia

Australia • Brazil • Japan • Korea • Mexico • Singapore • Spain • United Kingdom • United States

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page iv

MATLAB® Programming with Applications © 2013 Cengage Learning


for Engineers
ALL RIGHTS RESERVED. No part of this work covered by the copyright
Stephen J. Chapman
herein may be reproduced, transmitted, stored, or used in any form or by
Publisher, Global Engineering: Christopher any means graphic, electronic, or mechanical, including but not limited to
M. Shortt photocopying, recording, scanning, digitizing, taping, web distribution,
information networks, or information storage and retrieval systems, except
Senior Acquisitions Editor: Randall Adams
as permitted under Section 107 or 108 of the 1976 United States
Senior Developmental Editor: Hilda Gowans Copyright Act, without the prior written permission of the publisher.
Editorial Assistant: Tanya Altieri
Team Assistant: Carly Rizzo For product information and technology assistance, contact us at
Cengage Learning Customer & Sales Support, 1-800-354-9706.
Marketing Manager: Lauren Betsos
Media Editor: Chris Valentine For permission to use material from this text or product,
submit all requests online at www.cengage.com/permissions.
Content Project Manager: D. Jean Buttrom Further permissions questions can be emailed to
Production Service: RPK Editorial Services, Inc. permissionrequest@cengage.com.
Copyeditor: Shelly Gerger-Knechtl
Proofreader: Harlan James Library of Congress Control Number: 2011934123

Indexer: Shelly Gerger-Knechtl ISBN-13: 978-0-495-66807-7


Compositor: Integra Software Solutions ISBN-10: 0-495-66807-9
Senior Art Director: Michelle Kunkler
Internal Designer: Carmela Periera Cengage Learning
Cover Designer: Andrew Adams/4065042 200 First Stamford Place, Suite 400
Canada Inc. Stamford, CT 06902
USA
Cover Image: © ivn3da/Shutterstock;
© Martin Trajkovski/Shutterstock;
© Daisy Daisy/Shutterstock; Cengage Learning is a leading provider of customized learning solutions
© PhotoStocker/Shutterstock with office locations around the globe, including Singapore, the United
Rights Acquisitions Specialist: John Hill Kingdom, Australia, Mexico, Brazil, and Japan. Locate your local office at:
Text and Image Permissions Researcher: international.cengage.com/region.
Kristiina Paul
Senior First Print Buyer: Doug Wilke
Cengage Learning products are represented in Canada by
Nelson Education Ltd.

For your course and learning solutions, visit www.cengage.com/engineering.


Purchase any of our products at your local college store or at our preferred
online store www.cengagebrain.com.
MATLAB is a registered trademark of The MathWorks, Inc., 3 Apple Hill
Drive, Natick, MA.

Printed in the United States of America


1 2 3 4 5 6 7 13 12 11

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
This is an electronic version of the print textbook. Due to electronic rights restrictions, some third party content may be suppressed. Editorial
review has deemed that any suppressed content does not materially affect the overall learning experience. The publisher reserves the right to
remove content from this title at any time if subsequent rights restrictions require it. For valuable information on pricing, previous
editions, changes to current editions, and alternate formats, please visit www.cengage.com/highered to search by
ISBN#, author, title, or keyword for materials in your areas of interest.

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page v

This book is dedicated with love to my daughter Sarah Rivkah Chapman. As a student at
Swinburne University in Melbourne, she may actually wind up using it!

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page vi

About the Author

Stephen J. Chapman received a BS in Electrical Engineering from Louisiana State


University (1975), an MSE in Electrical Engineering from the University of
Central Florida (1979), and pursued further graduate studies at Rice University.
From 1975 to 1980, he served as an officer in the U.S. Navy, assigned to
teach Electrical Engineering at the U.S. Naval Nuclear Power School in Orlando,
Florida. From 1980 to 1982, he was affiliated with the University of Houston,
where he ran the power systems program in the College of Technology.
From 1982 to 1988 and from 1991 to 1995, he served as a Member of the
Technical Staff of the Massachusetts Institute of Technology’s Lincoln
Laboratory, both at the main facility in Lexington, Massachusetts, and at the field
site on Kwajalein Atoll in the Republic of the Marshall Islands. While there, he
did research in radar signal processing systems. He ultimately became the leader
of four large operational range instrumentation radars at the Kwajalein field site
(TRADEX, ALTAIR, ALCOR, and MMW).
From 1988 to 1991, Mr. Chapman was a research engineer in Shell
Development Company in Houston, Texas, where he did seismic signal process-
ing research. He was also affiliated with the University of Houston, where he con-
tinued to teach on a part-time basis.
Mr. Chapman is currently Manager of Systems Modeling and Operational
Analysis for BAE Systems Australia, in Melbourne, Australia. He is the leader of
a team that has developed a model of how naval ships defend themselves against
antiship missile attacks. This model contains more than 400,000 lines of
MATLABTM code written over more than a decade, so he has extensive practical
experience applying MATLAB to real-world problems.
Mr. Chapman is a Senior Member of the Institute of Electrical and Electronic
Engineers (and several of its component societies). He is also a member of the
Association for Computing Machinery and the Institution of Engineers (Australia).
vi

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page vii

Contents

Chapter 1 Introduction to MATLAB 1


1.1 The Advantages of MATLAB 2
1.2 Disadvantages of MATLAB 4
1.3 The MATLAB Environment 4
1.3.1 The MATLAB Desktop 4
1.3.2 The Command Window 6
1.3.3 The Command History Window 7
1.3.4 The Start Button 7
1.3.5 The Edit/Debug Window 9
1.3.6 Figure Windows 9
1.3.7 Docking and Undocking Windows 11
1.3.8 The MATLAB Workspace 11
1.3.9 The Workspace Browser 12
1.3.10 Getting Help 13
1.3.11 A Few Important Commands 15
1.3.12 The MATLAB Search Path 17
1.4 Using MATLAB as a Calculator 19
1.5 Summary 21
1.5.1 MATLAB Summary 22
1.6 Exercises 22

vii

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page viii

viii | Contents

Chapter 2 MATLAB Basics 25


2.1 Variables and Arrays 25
2.2 Creating and Initializing Variables in MATLAB 29
2.2.1 Initializing Variables in Assignment Statements 29
2.2.2 Initializing with Shortcut Expressions 32
2.2.3 Initializing with Built-in Functions 33
2.2.4 Initializing Variables with Keyboard Input 33
2.3 Multidimensional Arrays 35
2.3.1 Storing Multidimensional Arrays in Memory 37
2.3.2 Accessing Multidimensional Arrays with One Dimension 37
2.4 Subarrays 39
2.4.1 The end Function 39
2.4.2 Using Subarrays on the Left-hand Side of an Assignment
Statement 40
2.4.3 Assigning a Scalar to a Subarray 41
2.5 Special Values 42
2.6 Displaying Output Data 44
2.6.1 Changing the Default Format 44
2.6.2 The disp function 46
2.6.3 Formatted output with the fprintf function 46
2.7 Data Files 48
2.8 Scalar and Array Operations 50
2.8.1 Scalar Operations 51
2.8.2 Array and Matrix Operations 51
2.9 Hierarchy of Operations 54
2.10 Built-in MATLAB Functions 57
2.10.1 Optional Results 58
2.10.2 Using MATLAB Functions with Array Inputs 58
2.10.3 Common MATLAB Functions 58
2.11 Introduction to Plotting 60
2.11.1 Using Simple xy Plots 61
2.11.2 Printing a Plot 62
2.11.3 Exporting a Plot as a Graphical Image 62
2.11.4 Saving a Plot in a Figure File 63
2.11.5 Multiple Plots 63
2.11.6 Line Color, Line Style, Marker Style, and Legends 64
2.12 Examples 68
2.13 MATLAB Applications:Vector Mathematics 74
2.13.1 Vector Addition and Subtraction 76
2.13.2 Vector Multiplication 77
2.14 MATLAB Applications: Matrix Operations
and Simultaneous Equations 81
2.14.1 The Matrix Inverse 82

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page ix

Contents | ix

2.15 Debugging MATLAB Programs 84


2.16 Summary 86
2.16.1 Summary of Good Programming Practice 86
2.16.2 MATLAB Summary 87
2.17 Exercises 90

Chapter 3 Two-Dimensional Plots 103


3.1 Additional Plotting Features for Two-Dimensional Plots 103
3.1.1 Logarithmic Scales 104
3.1.2 Controlling x- and y-axis Plotting Limits 107
3.1.3 Plotting Multiple Plots on the Same Axes 110
3.1.4 Creating Multiple Figures 111
3.1.5 Subplots 111
3.1.6 Controlling the Spacing Between Points on a Plot 114
3.1.7 Enhanced Control of Plotted Lines 117
3.1.8 Enhanced Control of Text Strings 118
3.2 Polar Plots 121
3.3 Annotating and Saving Plots 123
3.4 Additional Types of Two-Dimensional Plots 126
3.5 Using the plot function with Two-Dimensional Arrays 131
3.6 Summary 133
3.6.1 Summary of Good Programming Practice 134
3.6.2 MATLAB Summary 134
3.7 Exercises 135

Chapter 4 Branching Statements and Program Design 139


4.1 Introduction to Top-Down Design Techniques 140
4.2 Use of Pseudocode 143
4.3 Relational and Logic Operators 144
4.3.1 Relational Operators 144
4.3.2 A Caution About The == And ⬃= Operators 146
4.3.3 Logic Operators 147
4.3.4 Logical Functions 151
4.4 Branches 153
4.4.1 The if Construct 154
4.4.2 Examples Using if Constructs 156
4.4.3 Notes Concerning the Use of if Constructs 162
4.4.4 The switch Construct 164
4.4.5 The try/catch Construct 166
4.5 More on Debugging MATLAB Programs 173
4.6 MATLAB Applications: Roots of Polynomials 178

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page x

x | Contents

4.7 Summary 181


4.7.1 Summary of Good Programming Practice 181
4.7.2 MATLAB Summary 182
4.8 Exercises 182

Chapter 5 Loops and Vectorization 189


5.1 The while Loop 189
5.2 The for Loop 195
5.2.1 Details of Operation 202
5.2.2 Vectorization: A Faster Alternative to Loops 204
5.2.3 The MATLAB Just-In-Time (JIT) Compiler 205
5.2.4 The break and continue Statements 208
5.2.5 Nesting Loops 210
5.3 Logical Arrays and Vectorization 212
5.3.1 Creating the Equivalent of if/else Constructs with
Logical Arrays 213
5.4 The MATLAB Profiler 215
5.5 Additional Examples 217
5.6 The textread Function 232
5.7 MATLAB Applications: Statistical Functions 234
5.8 MATLAB Applications: Curve Fitting and Interpolation 237
5.8.1 General Least-Squares Fits 237
5.8.2 Cubic Spline Interpolation 244
5.8.3 Interactive Curve-Fitting Tools 250
5.9 Summary 253
5.9.1 Summary of Good Programming Practice 254
5.9.2 MATLAB Summary 254
5.10 Exercises 255

Chapter 6 Basic User-Defined Functions 267


6.1 Introduction to MATLAB Functions 269
6.2 Variable Passing in MATLAB:The Pass-By-Value Scheme 274
6.3 Optional Arguments 285
6.4 Sharing Data Using Global Memory 290
6.5 Preserving Data Between Calls to a Function 298
6.6 MATLAB Applications: Sorting Functions 303
6.7 MATLAB Applications: Random Number Functions 305
6.8 Summary 306
6.8.1 Summary of Good Programming Practice 306
6.8.2 MATLAB Summary 306
6.9 Exercises 307

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xi

Contents | xi

Chapter 7 Advanced Features of User-Defined


Functions 317
7.1 Function Functions 317
7.2 Subfunctions and Private Functions 321
7.2.1 Subfunctions 322
7.2.2 Private Functions 323
7.2.3 Order of Function Evaluation 324
7.3 Function Handles 324
7.3.1 Creating and Using Function Handles 324
7.4 Anonymous Functions 327
7.5 Recursive Functions 328
7.6 Plotting Functions 329
7.7 Histograms 332
7.8 Summary 337
7.8.1 Summary of Good Programming Practice 337
7.8.2 MATLAB Summary 337
7.9 Exercises 338

Chapter 8 Complex Numbers and 3D Plots 345


8.1 Complex Data 345
8.1.1 Complex Variables 347
8.1.2 Using Complex Numbers with Relational Operators 348
8.1.3 Complex Functions 348
8.1.4 Plotting Complex Data 354
8.2 Multidimensional Arrays 358
8.3 Three-Dimensional Plots 360
8.3.1 Three-Dimensional Line Plots 360
8.3.2 Three-Dimensional Surface, Mesh, and Contour Plots 362
8.3.3 Creating Three-Dimensional Objects using Surface and
Mesh Plots 367
8.4 Summary 370
8.4.1 Summary of Good Programming Practice 370
8.4.2 MATLAB Summary 371
8.5 Exercises 371

Chapter 9 Cell Arrays, Structures, and Importing Data 375


9.1 Cell Arrays 375
9.1.1 Creating Cell Arrays 377
9.1.2 Using Braces {} as Cell Constructors 379
9.1.3 Viewing the Contents of Cell Arrays 379

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xii

xii | Contents

9.1.4 Extending Cell Arrays 380


9.1.5 Deleting Cells in Arrays 382
9.1.6 Using Data in Cell Arrays 383
9.1.7 Cell Arrays of Strings 383
9.1.8 The Significance of Cell Arrays 384
9.1.9 Summary of cell Functions 388
9.2 Structure Arrays 388
9.2.1 Creating Structure Arrays 390
9.2.2 Adding Fields to Structures 392
9.2.3 Removing Fields from Structures 392
9.2.4 Using Data in Structure Arrays 393
9.2.5 The getfield and setfield Functions 394
9.2.6 Dynamic Field Names 395
9.2.7 Using the size Function with Structure Arrays 397
9.2.8 Nesting Structure Arrays 397
9.2.9 Summary of structure Functions 398
9.3 Importing Data into MATLAB 403
9.4 Summary 405
9.4.1 Summary of Good Programming Practice 406
9.4.2 MATLAB Summary 406
9.5 Exercises 406

Chapter 10 Handle Graphics and Animation 411


10.1 Handle Graphics 411
10.1.1 The MATLAB Graphics System 411
10.1.2 Object Handles 413
10.1.3 Examining and Changing Object Properties 413
10.1.4 Using set to List Possible Property Values 420
10.1.5 Finding Objects 422
10.1.6 Selecting Objects with the Mouse 424
10.2 Position and Units 426
10.2.1 Positions of figure Objects 427
10.2.2 Positions of axes Objects 428
10.2.3 Positions of text Objects 428
10.3 Printer Positions 431
10.4 Default and Factory Properties 431
10.5 Graphics Object Properties 434
10.6 Animations and Movies 434
10.6.1 Erasing and Redrawing 434
10.6.2 Creating a Movie 439
10.7 Summary 441
10.7.1 Summary of Good Programming Practice 441
10.7.2 MATLAB Summary 442
10.8 Exercises 442

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xiii

Contents | xiii

Chapter 11 More MATLAB Applications 447


11.1 Solving Systems of Simultaneous Equations 447
11.1.1 Possible Solutions of Simultaneous Equations 449
11.1.2 Determining the Existence and Uniqueness of Solutions 451
11.1.3 Well-Conditioned Versus Ill-Conditioned Systems of Equations 452
11.1.4 Solving Systems of Equations with Unique Solutions 454
11.1.5 Solving Systems of Equations with an Infinite Number of
Solutions 456
11.1.6 Solving Overdetermined Systems of Equations 460
11.2 Differences and Numerical Differentiation 463
11.3 Numerical Integration—Finding the Area Under a Curve 466
11.4 Differential Equations 472
11.4.1 Deriving Differential Equations for a System 473
11.4.2 Solving Ordinary Differential Equations in MATLAB 476
11.4.3 Applying ode45 to Solve for the Voltage in a Circuit 480
11.4.4 Solving Systems of Differential Equations 482
11.4.5 Solving Higher Order Differential Equations 486
11.4.6 Stiff Differential Equations 489
11.5 Summary 490
11.5.1 Summary of Good Programming Practice 491
11.5.2 MATLAB Summary 492
11.6 Exercises 492

Appendix A ASCII Character Set 499

Appendix B Additional MATLAB Input/Output


Functions 501
B.1 MATLAB File Processing 501
B.2 File Opening and Closing 503
B.2.1 The fopen Function 503
B.2.2 The fclose Function 505
B.3 Binary I/O Functions 506
B.3.1 The fwrite Function 506
B.3.2 The fread Function 507
B.4 Formatted I/O Functions 510
B.4.1 The fprintf Function 510
B.4.2 Understanding Format Conversion Specifiers 512
B.4.3 The fscanf Function 514
B.4.4 The fgetl Function 516
B.4.5 The fgets Function 516
B.5 The textscan Function 516

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xiv

xiv | Contents

Appendix C Working with Character Strings 519


C.1 String Functions 519
C.1.1 String Conversion Functions 520
C.1.2 Creating Two-Dimensional Character Arrays 520
C.1.3 Concatenating Strings 521
C.1.4 Comparing Strings 521
C.1.5 Searching and Replacing Characters within a String 525
C.1.6 Uppercase and Lowercase Conversion 526
C.1.7 Trimming Whitespace from Strings 527
C.1.8 Numeric-to-String Conversions 527
C.1.9 String-to-Numeric Conversions 529
C.1.10 Summary 530
C.2 Summary 536
C.2.1 Summary of Good Programming Practice 536
C.2.2 MATLAB Summary 537
C.3 Exercises 538

Appendix D Answers to Quizzes 539

Index 555

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xv

Preface

MATLAB® (short for MATrix LABoratory) is a special-purpose computer pro-


gram optimized to perform engineering and scientific calculations. It started life
as a program designed to perform matrix mathematics, but over the years it has
grown into a flexible computing system capable of solving essentially any tech-
nical problem.
The MATLAB program implements the MATLAB language and provides a
very extensive library of pre-defined functions to make technical programming
tasks easier and more efficient. This extremely wide variety of functions makes it
much easier to solve technical problems in MATLAB than in other languages
such as Java, Fortran, or C⫹⫹. This book introduces the MATLAB language, and
shows how to use it to solve typical technical problems.
This book seeks to simultaneously teach MATLAB as a technical program-
ming language and also to introduce the student to many of the practical functions
that make solving problems in MATLAB so much easier than in other languages.
The book provides a complete introduction to the fundamentals of good proce-
dural programming, developing good design habits that will serve a student well
in any other language that he or she may pick up later. There is a very strong
emphasis on proper program design and structure. A standard program design
process is introduced at the beginning of Chapter 4 and then followed regularly
throughout the remainder of the text.
In addition, the book uses the programming topics and examples as a jumping
off point for exploring the rich set of highly optimized application functions that are
built directly into MATLAB. For example, in Chapter 4 we present a programming
example that finds the roots of a quadratic equation. This serves as a jumping off
point for exploring the MATLAB function roots, which can efficiently find the

xv

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xvi

xvi | Preface

roots of polynomials of any order. In Chapter 5, we present a programming exam-


ple that calculates the mean and standard deviation of a data set. This serves as a
jumping off point for exploring the MATLAB functions mean, median, and std.
There is also a programming example showing how to do a least-squares fit to a
straight-line. This serves as a jumping off point for exploring MATLAB curve fit-
ting functions such as polyfit, polyval, spline, and ppval. There are sim-
ilar ties to MATLAB applications in many other chapters as well. In all cases, there
are end of chapter exercises to reinforce the applications lessons learned in that
chapter.
In addition, Chapter 11 is devoted totally to practical MATLAB applica-
tions, including solving systems of simultaneous equations, numerical differen-
tiation, numerical integration (quadrature), and solving ordinary differential
equations.
This book makes no pretense at being a complete description of all of
MATLAB’s hundreds of functions. Instead, it teaches the student how to use
MATLAB as a language to solve problems, and how to locate any desired function
with MATLAB’s extensive on-line help facilities. It highlights quite a few of the
key engineering applications, but there are far more good ones built into the lan-
guage than can be covered in any course of reasonable length. With the skills
developed here, students will be able to continue discovering features on their own.

The Advantages of MATLAB for Problem Solving


MATLAB has many advantages compared to conventional computer languages
for technical problem solving. Among them are:
1. Ease of Use. MATLAB is very easy to use. The program can be used as
a scratch pad to evaluate expressions typed at the command line, or it can
be used to execute large pre-written programs. Programs may be easily
written and modified with the built-in integrated development environ-
ment, and debugged with the MATLAB debugger. Because the language
is so easy to use, it is ideal for educational use, and for the rapid proto-
typing of new programs.
Many program development tools are provided to make the program
easy to use. They include an integrated editor / debugger, on-line docu-
mentation and manuals, a workspace browser, and extensive demos.
2. Platform Independence. MATLAB is supported on many different com-
puter systems, providing a large measure of platform independence. At
the time of this writing, the language is supported on Windows
XP/Vista/7, Linux, Unix, and the Macintosh. Programs written on any
platform will run on all of the other platforms, and data files written on
any platform may be read transparently on any other platform. As a result,
programs written in MATLAB can migrate to new platforms when the
needs of the user change.

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xvii

Preface | xvii

3. Pre-defined Functions. MATLAB comes complete with an extensive


library of pre-defined functions that provide tested and pre-packaged
solutions to many basic technical tasks. For example, suppose that you are
writing a program that must calculate the statistics associated with an
input data set. In most languages, you would need to write your own sub-
routines or functions to implement calculations such as the arithmetic
mean, standard deviation, median, etc. These and hundreds of other func-
tions are built right into the MATLAB language, making your job much
easier.
The built-in functions can solve an astonishing range of problems,
such as solving systems of simultaneous equations, sorting, plotting, find-
ing roots of equations, numerical integration, curve fitting, solving ordi-
nary and partial differential equations, and much, much more.
In addition to the large library of functions built into the basic MAT-
LAB language, there are many special-purpose toolboxes available to help
solve complex problems in specific areas. For example, a user can buy
standard toolboxes to solve problems in Signal Processing, Control
Systems, Communications, Image Processing, and Neural Networks,
among many others.
4. Device-Independent Plotting. Unlike other computer languages, MAT-
LAB has many integral plotting and imaging commands. The plots and
images can be displayed on any graphical output device supported by
the computer on which MATLAB is running. This capability makes
MATLAB an outstanding tool for visualizing technical data. Plotting is
introduced in Chapter 2, and covered extensively in Chapters 3 and 8.
Advanced features such as animations and movies are covered in
Chapter 10.
5. Graphical User Interface. MATLAB includes tools that allow a pro-
gram to interactively construct a Graphical User Interface (GUI) for his
or her program. With this capability, the programmer can design sophis-
ticated data analysis programs that can be operated by relatively-inexpe-
rienced users.

Features of this Book


Many features of this book are designed to emphasize the proper way to write
reliable MATLAB programs. These features should serve a student well as he or
she is first learning MATLAB, and should also be useful to the practitioner on the
job. They include:
1. Emphasis on Top-Down Design Methodology. The book introduces a
top-down design methodology in Chapter 4, and then uses it consistently
throughout the rest of the book. This methodology encourages a student

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xviii

xviii | Preface

to think about the proper design of a program before beginning to code. It


emphasizes the importance of clearly defining the problem to be solved
and the required inputs and outputs before any other work is begun. Once
the problem is properly defined, it teaches the student to employ stepwise
refinement to break the task down into successively smaller sub-tasks,
and to implement the subtasks as separate subroutines or functions.
Finally, it teaches the importance of testing at all stages of the process,
both unit testing of the component routines and exhaustive testing of the
final product.
The formal design process taught by the book may be summarized as follows:
1. Clearly state the problem that you are trying to solve.
2. Define the inputs required by the program and the outputs to be produced
by the program.
3. Describe the algorithm that you intend to implement in the program. This
step involves top-down design and stepwise decomposition, using
pseudocode or flow charts.
4. Turn the algorithm into MATLAB statements.
5. Test the MATLAB program. This step includes unit testing of specific
functions, and also exhaustive testing of the final program with many dif-
ferent data sets.
2. Emphasis on Functions. The book emphasizes the use of functions to
logically decompose tasks into smaller subtasks. It teaches the advantages
of functions for data hiding. It also emphasizes the importance of unit
testing functions before they are combined into the final program. In addi-
tion, the book teaches about the common mistakes made with functions,
and how to avoid them.
3. Emphasis on MATLAB Tools. The book teaches the proper use of
MATLAB’s built-in tools to make programming and debugging easier.
The tools covered include the Editor / Debugger, Workspace Browser,
Help Browser, and GUI design tools.
4. Emphasis on MATLAB applications. The book teaches how to harness
the power of MATLAB’s rich set of functions to solve a wide variety of
practical engineering problems. This introduction to MATLAB functions
is spread throughout the book, and is generally tied to the topics and
examples being discussed in a particular chapter.
5. Good Programming Practice Boxes. These boxes highlight good pro-
gramming practices when they are introduced for the convenience of the
student. In addition, the good programming practices introduced in a
chapter are summarized at the end of the chapter. An example Good
Programming Practice Box is shown below.

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xix

Preface | xix

✷ Good Programming Practice:


Always indent the body of an if construct by 2 or more spaces to improve the
readability of the code.

6. Programming Pitfalls Boxes


These boxes highlight common errors so that they can be avoided. An
example Programming Pitfalls Box is shown below.

 Programming Pitfalls:
Make sure that your variable names are unique in the first 63 characters. Otherwise,
MATLAB will not be able to tell the difference between them.

Pedagogical Features
This book includes several features designed to aid student comprehension. A
total of 13 quizzes appear scattered throughout the chapters, with answers to all
questions included in Appendix D. These quizzes can serve as a useful self-test of
comprehension. In addition, there are approximately 215 end-of-chapter exercis-
es. Answers to all exercises are included in the Instructor’s Manual. Good pro-
gramming practices are highlighted in all chapters with special Good
Programming Practice boxes, and common errors are highlighted in
Programming Pitfalls boxes. End of chapter materials include Summaries of
Good Programming Practice and Summaries of MATLAB Commands and
Functions.
The book is accompanied by an Instructor’s Manual, containing the solutions
to all end-of-chapter exercises. The IM, PowerPoint slides of all figures and tables
in the book and the source code for all examples in the book is available from the
book’s Web site, and the source code for all solutions in the Instructor’s Manual
is available separately to instructors.
To access additional course materials [including CourseMate], please visit
www.cengagebrain.com. At the cengagebrain.com home page, search for the
ISBN of your title (from the back cover of your book) using the search box at the
top of the page. This will take you to the product page where these resources can
be found.

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_00_fm_pi-xx.qxd 9/2/11 1:49 PM Page xx

xx | Preface

A Thank You to the Reviewers


I would like to offer a special thank you to the book’s reviewers. Their invaluable
suggestions have made this a significantly better book, and they certainly deserve
thanks for the time they devoted to reviewing drafts of the text. The reviewers who
were willing to be named are:
Steven A. Peralta, University of New Mexico
Jeffrey Ringenberg, University of Michigan
Lizzie Santiago, West Virginia University
John R. White, University of Massachusetts, Lowell

A Final Note to the User


No matter how hard I try to proofread a document like this book, it is inevitable
that some typographical errors will slip through and appear in print. If you should
spot any such errors, please drop me a note via the publisher, and I will do my
best to get them eliminated from subsequent printings and editions. Thank you
very much for your help in this matter.
I will maintain a complete list of errata and corrections at the book’s World
Wide Web site, which is http://www.cengage.com/engineering. Please check that
site for any updates and/or corrections.

STEPHEN J. CHAPMAN
Melbourne, Australia

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_01_ch01_p001-024.qxd 9/2/11 12:46 PM Page 1

C H A P T E R 1
Introduction
to MATLAB

MATLAB (short for MATrix LABoratory) is a special-purpose computer program


optimized to perform engineering and scientific calculations. It started life as a
program designed to perform matrix mathematics, but over the years, it has
grown into a flexible computing system capable of solving essentially any techni-
cal problem.
The MATLAB program implements the MATLAB programming language and
provides an extensive library of predefined functions to make technical pro-
gramming tasks easier and more efficient.This book introduces the MATLAB lan-
guage as it is implemented in MATLAB Version 7.9 and shows how to use it to
solve typical technical problems.
MATLAB is a huge program, with an incredibly rich variety of functions. Even
the basic version of MATLAB without any toolkits is much richer than other
technical programming languages. There are more than 1000 functions in the
basic MATLAB product alone, and the toolkits extend this capability with many
more functions in various specialties. Furthermore, these functions often solve
very complex problems (solving differential equations, inverting matrices, and so
forth) in a single step, saving large amounts of time. Doing the same thing in
another computer language usually involves writing complex programs yourself
or buying a third-party software package (such as IMSL or the NAG software
libraries) that contains the functions.
The built-in MATLAB functions are almost always better than anything that
an individual engineer could write on his or her own, because many people have
worked on them and they have been tested against many different data sets.
These functions are also robust, producing sensible results for wide ranges of
input data and gracefully handling error conditions.

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
68077_01_ch01_p001-024.qxd 9/2/11 12:46 PM Page 2

2 | Chapter 1 Introduction to MATLAB

This book makes no attempt to introduce the user to all of MATLAB’s func-
tions. Instead, it teaches a user the basics of how to write, debug, and optimize good
MATLAB programs and provides a subset of the most important functions used to
solve common scientific and engineering problems. Just as importantly, it teaches the
scientist or engineer how to use MATLAB’s own tools to locate the right function
for a specific purpose from the enormous amount of choices available. In addition,
it teaches how to use MATLAB to solve many practical engineering problems, such
as vector and matrix algebra, curve fitting, differential equations, and data plotting.
The MATLAB program is a combination of a procedural programming
language, an integrated development environment (IDE) including an editor and
debugger, and an extremely rich set of functions that can perform many types of
technical calculations.
The MATLAB language is a procedural programming language, meaning that
the engineer writes procedures, which are effectively mathematical recipes for
solving a problem. This makes MATLAB very similar to other procedural
languages such as C, Basic, Fortran, and Pascal. However, the extremely rich list
of predefined functions and plotting tools makes it superior to these other
languages for many engineering analysis applications.

1.1 The Advantages of MATLAB


MATLAB has many advantages compared to conventional computer languages
for technical problem solving. Among them are:
1. Ease of Use
MATLAB is an interpreted language, like many versions of Basic, and
like Basic, it is very easy to use. The program can be used as a scratch
pad to evaluate expressions typed at the command line, or it can be used
to execute large prewritten programs. Programs may be easily written
and modified with the built-in integrated development environment and
can be debugged with the MATLAB debugger. Because the language is
so easy to use, it is ideal for the rapid prototyping of new programs.
Many program development tools are provided to make the program
easy to use. They include an integrated editor/debugger, on-line docu-
mentation and manuals, a workspace browser, and extensive demos.
2. Platform Independence
MATLAB is supported on many different computer systems, providing a
large measure of platform independence. At the time of this writing, the
language is supported on Windows XP/Vista/7, Linux, Unix, and the
Macintosh. Programs written on any platform will run on all of the other
platforms, and data files written on any platform may be read transpar-
ently on any other platform. As a result, programs written in MATLAB
can migrate to new platforms when the needs of the user change.

Copyright 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. Due to electronic rights, some third party content may be suppressed from the eBook and/or eChapter(s). Editorial review has
deemed that any suppressed content does not materially affect the overall learning experience. Cengage Learning reserves the right to remove additional content at any time if subsequent rights restrictions require it.
Other documents randomly have
different content
director since its foundation. Joachim invited Agnes to his house one
evening to meet Brahms, who, coming forward to greet her, said it
was as though her mother were again standing before him. He sent
her a selection of his songs, and in due time she became a
distinguished singer, appearing in public under a pseudonym, and
the wife of a famous musician.
Lischen saw only the first four numbers of the 'Magelone' song-cycle,
which had, by a strange coincidence, just been completed at the
time of her visit; the fifth and sixth were not composed until May,
1862.[92] These six songs were published by Rieter-Biedermann in
1865, with the title 'Romanzen aus L. Tieck's Magelone' and a
dedication to Stockhausen; and there can be no doubt that the
immediate incitement to their composition is to be traced to our
composer's association with this great singer in the performance of
the song-cycles of Beethoven, Schubert, and Schumann. The
remaining nine songs of Brahms' series were not published until
1868, and the exact date of their composition has not been
ascertained.
'I am living most delightfully in the country, half an hour
from town,' wrote Brahms, pressing Dietrich to pay him a
visit; 'you would be surprised to find how pleasantly one
can live here. Perhaps I can take you in, and at any rate
my room at my parents' in Hamburg is quite at your
service. In short, I hope you will be comfortable.'
He was established for the summer at Hamm in the pleasant country
house of Frau Dr. Rösing, aunt of the two girls, the Fräulein Betty
and Marie Völckers, already mentioned as members of the choir.
Here a large airy room with a balcony, on the first floor, had been
allotted him, that had been the billiard-room of the house when it
was inhabited by Herr Völckers and his family. This gentleman now
lived next door with his two daughters in a charming old-fashioned
habitation built, cottage-wise, with a thatched roof and but two
floors, and possessing a spacious apartment on the ground-floor that
was particularly well adapted for the choir practices. Both houses
had pleasant gardens separated only by a green hedge, and close
by, the spreading branches of fine old trees provided shelter for the
many nightingales that built their nests in the quiet spot. Brahms'
room was cheerful for a considerable part of the day, with the
sunlight that shone through the outside greenery and the tinted
panes of the open windows, and in it he could enjoy his favourite
early morning hours of work with the added relish of feeling that
they were but the prelude to days of quiet refreshment. He was
intimate with all the branches of his hostess's family, from Herr
Völckers, who had been a good public singer of his day, down to his
gifted little granddaughter Minna (now Mrs. Edward Stone), one of
the young composer's very favourite and most devoted pianoforte
pupils; and that he passed a considerable portion of his time this
summer in the society of the two girls next door—Betty and Marie
Völckers—will astonish none of our readers. He went in and out their
house as he liked, and frequently joined them as they sat in their
garden with work or books, or chatting with their friends Fräulein
Reuter and Fräulein Laura Garbe, whom they often invited. Johannes
would stroll in with his cigar or cigarette, and take a seat near the
group, silent or talkative according to his inclination. By-and-by he
would sing a note or two of a well-known melody, begin to beat
time, and the garden would be glad with the sound of four fresh
young voices swelling and dying together in the charming harmonies
of a favourite part-song. He often spent the evening with the young
ladies and their father, gladly accepting their informal hospitality, and
would play to them after supper until late into the night, sometimes
performing duets with Fräulein Marie, who was his pupil on the
pianoforte.
'I may say with pride that he was happy in our little house,' said
Frau Professor Böie (Fräulein Marie Völckers) to the author; 'his
playing was a great delight to our old father. His behaviour to old
people was touchingly thoughtful and kind.'
Dietrich, who had lately accepted the post of court capellmeister to
the Grand-Duke of Oldenburg, and was now quite a near neighbour,
paid his promised visit to Hamburg in September, and found
Johannes engaged on the A major Pianoforte Quartet. 'He played me
the sketches which convinced me that the work would be
surpassingly fine.'
'I occupied his very interesting room [at Hamburg], and
was astonished at his comprehensive library, which he had
gradually collected since early youth; it contained some
remarkable old works.
'After breakfast in the morning I used to sit cosily with his
dear old mother, who united true heart-culture with her
plainness and simplicity; her Johannes was the
inexhaustible subject of our lively conversations. The
father generally left home early to follow his calling of
bassist and music-teacher. I used to remain a little while
with the dear people, and spent the rest of the day with
Brahms in his charming country quarters, where we
occupied ourselves with the detailed examination of his
newest works.'
Several indications suggest that Brahms' thoughts were still turned
longingly in the direction of Vienna; not as a permanent place of
residence—at no time in his life, probably, did he so seriously
contemplate settling in Hamburg as at the present—but he wished to
see the city that had been the home of Haydn, Mozart, Beethoven,
and Schubert; and the enthusiastic sympathy accorded to Frau
Schumann on each of her visits to the Austrian capital confirmed him
in a desire to try his luck with its music-loving public. He knew his
way had been prepared for him, and a good opportunity seemed
likely to occur for his appearance there. Joachim was meditating
another Austrian tour, and would have rejoiced to have Johannes
with him. Matters went no further, however, than they had done
previously. As in a former year, paragraphs appeared in the Signale
announcing that Brahms and Joachim were about to visit Vienna, but
in the end Brahms remained at home—partly, no doubt, from
motives of policy.
It was generally understood that Wilhelm Grund, who had for many
years conducted the Philharmonic concerts and the Singakademie
connected with them, must soon retire. He had done good work in
his day, but his day was over. Musical conditions had changed; he
was too old to alter with them, and the Philharmonic performances
had long ceased to satisfy modern requirements. It was hoped by
Brahms' friends that the young genius of Hamburg would succeed to
the post, and Johannes himself may have thought it wise to remain
on the spot with such an important issue imminent. The
disappointment he felt at giving up the desired journey was partially
consoled by the knowledge that Frau Schumann would be much in
Hamburg during the autumn months.
He began his concert-season on October 19 at Altona, and appeared
at one of the Böie-Lee concerts later in the month, playing the
Schumann Variations for two pianofortes with Frau Clara. On the
30th there was a music-party at the Halliers', which is charmingly
described in a letter written a few days afterwards by Fräulein Julie
Hallier:
'The guests were late in coming; it was half-past eight
when they had all arrived; and who comes with Frau
Schumann?—Our dear friend from Hanover, with his
beaming face and delightful friendliness; the glorious
Joachim. Everyone was taken by surprise, Frau Schumann
and Brahms in the morning, we in the evening. Avé: "My
boy! where have you come from?" After the first
excitement was over, Edward showed his Italian
photographs. Brahms literally devoured them; he was very
nice the whole evening, especially with Edward. He teased
me about my punch, which I altered three times, he
following it with anxious looks as the bowl disappeared
through the door. Frau Schumann and Brahms played
beautifully beyond imagination; three rondos by Schubert
and two marches. The violin of course had not come;
Joachim only arrived yesterday and is already gone again.
At first Avé turned over, but he did it badly, so Brahms
called Joachim. Avé: "My dreadful cold; I cannot see
properly." He now stood behind and began to beat time.
During the music the table was laid in the small room. It
was rather narrow, but comfortable. All went well. We
separated at half-past eleven.'
A few days afterwards there was a similar gathering at the Wagners',
when Frau Schumann performed with Brahms his duet arrangement
of the second serenade.
'The best of all was a set of variations by Brahms on a
theme by Handel,' continues the letter—'another
magnificent work! splendidly long—the stream of ideas
flowing inexhaustibly! And the work was splendidly played,
too, by himself. It seemed like a miracle; one could not
take one's eyes from him. The composition is so difficult
that none but great artists could attempt it.'[93]
These words give some measure of the progress effected during the
last half-century in the technique of pianoforte-playing, partly,
indeed, through the demands made upon pianists by the
compositions of Brahms himself. Lovers of his art who have learnt
his particular technique, which demands of the player certain
qualities of endurance and grip, do not find the performance of his
works unduly fatiguing. The twenty-five variations, with the fugue
that succeeds them, are now in the fingers of most good players,
and would undoubtedly be often heard in the concert-room if it were
not for the great length of the work. They show a melodious fertility
and power of invention which is practically inexhaustible. Each
variation or pair of variations presents some fresh idea, some
striking change of fancy, figuration, rhythm, mood, to hold the
listener's attention, whilst the entire long work is essentially based
upon the simple harmonic progression of Handel's theme (to be
found in the second collection of Harpsichord Pieces). The changes
of key in Brahms' variations are restricted to the tonic minor (Nos. 5,
6, 13) and the relative minor (No. 21). The finale, the great free
fugue which invariably 'brings down' a house, is, with its grand and
brilliant climax, to which extraordinary effect is imparted by an
original employment of the dominant pedal point, a unique example
of its kind.
If there ever were a young composer who had reason to be made
happy from the outset of his career by the appreciation of the most
eminent of his colleagues—appreciation sweeter than any other to
the soul of the true artist—Brahms was he. At each of Frau
Schumann's three appearances in Hamburg during this autumn, she
performed a great work of his composition, two being introduced for
the first time to the public. At her first concert, on November 16, she
played the G minor Pianoforte Quartet, only now finally revised and
completed, with Böie, Breyther, and Lee, and on the same evening
several of the composer's part-songs were sung under his direction
by the Ladies' Choir; on December 3 she appeared as the champion
of the unpopular Concerto, choosing it for her chief solo at the
Philharmonic concert of that date; and on the 7th of the same
month she brought forward the Handel Variations and Fugue at her
second concert. These she repeated a week later at the
Gewandhaus soirée of the 14th in Leipzig.
Not even the magnetic personality of Frau Schumann availed to
awaken any show of enthusiasm for the concerto. The new works
were more favourably received both in Hamburg and Leipzig, and
the Signale itself bestowed a mild word or two upon some of the
variations. It is easy, however, to read between the lines of the press
notices that such encouragement as was awarded to the composer
was mainly due to the personality of the performer. The B flat Sextet
was given with fair success at the Gewandhaus Quartet concert of
January 4 by David Röntgen, Hermann, Hunger, Davidoff, and
Krummholtz.
Brahms passed the first two months of the new year in Joachim's
society, making his headquarters at Hanover, and undertaking
frequent short journeys with his friend. The two artists appeared
together on January 20 at one of the Münster subscription concerts,
of which Grimm, who had been called to Münster in 1860, was now
the conductor; and on February 14 they gave a concert in Celle, a
locality which the reader will remember as the scene of Johannes'
transposition feat during the Reményi tournée of 1853. The A major
Pianoforte Quartet was now finished, and was, with its companion in
G minor, much appreciated in the private circles of Hanover, where
both works were frequently played by Brahms with Joachim and his
colleagues.
Brahms, answering an invitation from Dietrich received on the eve of
his departure, says:
'Hanover, 1862.

'Dear Friend,
'I have been here for some time, and have your letter
forwarded from Hamburg. I go back to-morrow, and write
a few words in haste.
'I should much like to visit you and to make the
acquaintance of those whom I know pleasantly by name,
otherwise I would say no. I will come and see how long I
can afford to be idle.
'What shall I play? Beethoven or Mozart? C minor, A major,
or G major? Advise!
'And for the second?—Schumann, Bach, or may I venture
upon some new variations of my own?
'You, of course, will conduct my serenade. We have been
playing my quartets a great deal here; I shall bring them
with me and shall be glad if you and others approve of
them.
À
'À propos! I must have an honorarium of 15 Louis-d'ors
[about £14], with the stipulation that if I should play at
Court I receive extra remuneration. I much need the
money; pro sec. my time is valuable to me, and I do not
willingly take concert engagements; if, however, this must
be, then the other must also.'[94]
Dietrich had already had the pleasure of welcoming Frau Schumann
and Joachim to Oldenburg during this his first season of activity
there, and had worked well to prepare the way for Brahms, so that
the evening of March 14, the date fixed for the composer's personal
introduction to the concert-going public, was awaited with keen
interest. Arriving at Dietrich's house a few days previously, Brahms
found himself surrounded by new friends, and had won the favour of
the musical élite of the town before his public appearance, by
playing several of his works in private circles. The members of the
orchestra, who assembled en masse on the evening of the 13th,
were excited to enthusiasm by his performance of the new Handel
Variations and Fugue, and every condition that could insure a
sympathetic reception for the hero of the 14th was fulfilled.
The concert opened with the D major Serenade (Op. 11), conducted
by Dietrich, who had the delight of finding that he had secured an
adequate reception for his friend's orchestral work.
'The whole made the most satisfactory impression, and
carried the hearers away more and more, especially from
the fourth movement onwards, and at the close the
applause reached a pitch of enthusiasm not hitherto
experienced here. The members of the orchestra, who
had been studying the serenade for some time, showed
their concurrence in the general approval by a lively
flourish' (Oldenburger Zeitung).
No less satisfactory was the verdict of the audience on the
performances of Beethoven's G major Concerto and Bach's
Chromatic Fantasia, with which our composer came forward as
pianist. His success was repeated at the chamber music concert of
the 19th, when the sextet was performed by Court Concertmeister
Engel and his colleagues. Both in public and private Brahms left
endearing memories behind him.
'He was the most agreeable guest,' says Dietrich, 'always
pleased, always good-humoured and satisfied, like a child
with the children.
'He took the greatest pleasure in our happiness. He
thought our modest lot enviable, and had his position then
allowed him to establish a home of his own, perhaps this
might have been the right moment, for he was attracted
by a young girl who was often with us. One evening,
when she and other guests had left, he said with quiet
decision: "She pleases me; I should like to marry her;
such a girl would make me, too, happy." He met many
people at our house, and in small and large circles outside
it, and everyone liked his earnest nature and his short and
often humorous remarks.'
It is pleasant to have to record here that a few weeks before the
events now described, New York, distinguished, as we have seen, by
Mason's timely performance of the B major Trio in 1855, led the way
a second time in connection with Brahms' career. In February, 1862,
the first performance after publication of the second serenade took
place there at a Philharmonic concert, and the occasion is doubly
memorable as marking the earliest introduction of an orchestral work
of Brahms to a public audience outside the cities of Hamburg,
Hanover, and Leipzig. This early appreciation of the composer's
genius in America has proved to have been neither accidental nor
transitory. It grew steadily year by year with the general growth of
interest in musical art, and his works, great and small, were
welcomed as they appeared, and performed—often, it must be said,
from pirated editions in the earlier days—with ever-increasing
success. It has been impossible to ascertain the exact dates of first
American performances. New York, the earliest centre in the United
States for the cultivation of Brahms' music, was emulated later on,
especially by Boston; and the famous Symphony Orchestra of this
city has, since its foundation in 1881, performed each of the four
symphonies, in Boston and in the course of numerous concert tours,
at an average of forty concerts; whilst the two overtures, the
concertos, and other large works, have been given with
corresponding frequency.
The chamber music has been a special feature in the programmes of
several concert-parties resident in various parts of the United States.
Of these, special mention should be made of the Kneisel String
Quartet of Boston, whose performances, familiar not only to
American, but also to some of the circles of European music-lovers,
were warmly appreciated by Brahms himself.
In the spring of 1862, an artistic tour undertaken in France by Frau
Schumann laid the foundation of Brahms' reputation in Paris, which,
little to be noted during many years, has of late been rapidly
increasing. That the great pianist, when introducing her husband's
works, which were almost unknown to French audiences, had to
confront the inevitable prejudice against what is new, explains the
fact that Brahms' name did not appear in the programmes of her
concerts at the Salle Erard. The efforts she made in the cause of his
art, however, amongst the inmost musical circle of her acquaintance
created an impression that was not entirely fleeting.
The two first Pianoforte Quartets, now finally completed, and
performed, as we have seen, during the winter of 1861-62—the
earlier one in public, and both frequently in private—add two
glorious works of chamber music to the series so brilliantly
inaugurated by the Sextet in B flat. In their broadly-flowing themes,
their magnificent wealth of original and contrasted melody, their
consummate workmanship, their fresh, vigorous vitality, their
enchanting romance, one seems to hear the bounding gladness of
the artist-spirit which has attained freedom through submission to
law, and revels in its emancipation. They are so rich in beauty, so
transcendent in power, that the attempt to point out this or that
particular detail for admiration results in bewilderment. The romantic
intermezzo, the riotously brilliant Hungarian rondo, of the first; the
graceful scherzo with its bold trio, of the second, and the adagio,
with its atmosphere of mystery, lit up twice by the outbreak of
passion that subsides again to the hushed expressiveness of the
beginning and end; the opening allegro of either work—all are
original, great, beautiful; but so is every portion of every movement
of both quartets, and each movement proclaims—from Bach to
Brahms. That Brahms' course of development proceeded ever
further in the direction of concentration of thought and conciseness
of structure cannot affect the value of the splendid achievements of
his earlier period of maturity, and of these the two quartets stand
amongst the greatest.
The sincerity of Brendel's efforts to conciliate the contending musical
parties, and his desire to do justice to each, is strikingly proved by
the appearance in his journal, in the course of several months of the
year 1862, of a series of articles signed 'D. A. S.,' by Dr. Schübring, a
distinguished musician and critic of the Schumann school. The first
few numbers are devoted to sympathetic reviews of the works of
Theodor Kirchner, Woldemar Bargiel, and others; and following these
are five articles in which the whole of Brahms' published works are
examined in detail. The composer's genius, his progress, his moods
and his methods, are discussed with the skill of a scientific musician,
the impartiality of a sound critic, and the affection of a personal and
artistic friend. They are too technical for quotation here, but the last
sentence of the concluding number may be given in well-deserved
tribute to Brendel, who must have known what he was doing when
he arranged for Dr. Schübring's contributions.
'The foregoing words may sound inflated, but stopped
horns are of no use when it is desired to arouse the great
public, which does not yet seem to comprehend in the
least what a colossal genius, one quite of equal birth with
Bach, Beethoven, and Schumann, is ripening in the young
master of Hamburg.'
The mediator's task is seldom a grateful one, and it appears
probable that Dr. Brendel was reproached for his large-mindedness
by some of the New-German party, with whom he had been so long
intimately connected, as a half-apologetic explanation of his reasons
for desiring the publication of the 'Schumanniana,' as the articles
were entitled, appeared in a later number of the Zeitschrift.
It would be unsatisfactory to omit all mention of the first
performance of a 'Magelone Romance,' though there is but little to
record save the fact that Stockhausen sang the opening one, the
'Keinem hat es noch gereut,' from the manuscript, at the
Philharmonic concert of April 4, as one of a group of songs by
Brahms. It produced no impression whatever on the Hamburgers,
who were only mystified. How many persons in the audience had
read Tieck's poems? How many had ever heard anything about the
adventures of Magelone and Peter? Without such knowledge, the
first and second numbers of the cycle cannot be really appreciated.
To those who are aware that the first is the song of a minstrel who
incites a valiant young hero to journey to distant lands in quest of
adventure, and the second the exultant shout of the joyful aspirant
as he rides forth from his parents' home, resolved on doughty
deeds, the music becomes living, and seems to breathe forth the
very spirit of chivalry. The third, fourth, and some other of the
songs, notably the ninth—the ravishing 'Ruhe Süssliebchen'—are
capable of telling a tale of their own, and give rich delight apart from
their place in Tieck's version of the story; but the enjoyment even of
these favourite and familiar songs is much heightened by an
acquaintance with the incidents of the romance. Tieck's 'Beautiful
Magelone' is contained in his 'Phantasus,' a collection of tales
published between 1812 and 1816, some of which have been made
familiar to English readers by the translations of Hare, Froude, and
Carlyle. The 'Magelone' story of the book is a modernized version of
an old romance of chivalry, and, by introducing into it a number of
songs, Tieck furnished the opportunity seized upon more than forty
years later by Brahms, to which the world is indebted for some of
the composer's most perfect inspirations.
To provide in this place the much-needed clue to their connexion
with the events of the tale would cause too serious an interruption
to our narrative. The author has therefore added, in Appendix II., an
account of the romance and the incidence of Tieck's songs, which it
is hoped may interest the reader and increase his love for the
compositions.
Brahms continued to make Frau Dr. Rösing's house his headquarters,
and remained there during most of the spring and summer of 1862.
Before going to Oldenburg in March, he had written to Dietrich: 'It is
delightful here in Hamm, and unless I look out of window at the
bare trees I fancy summer is come, the sunlight plays in the room
so, gaily.' Later it was: 'It is blooming splendidly, and the trees are
blossoming in Hamm, so that it is a joy.' He occupied his leisure in
similar agreeable pursuits to those of the preceding year, and now in
the springtime a double choir of maidens and nightingales might
often be heard by the passer-by, carolling together as if in mutual
emulation of the others' song. He begged, later on, for photographs
of his girls' quartet and of the two houses, and said that he neither
remembered nor saw before him a happier time than that he had
passed in Hamm. The sisters met their fate in due time. Each
married a distinguished violinist, and Concertmeister Otto von
Königslow of Cologne and Professor John Böie of Altona were
amongst the most active admirers of Brahms' art. The composer
remained on terms of intimacy with the entire Völckers family, and
never failed, when occasionally staying at Hamburg during the later
years of his career, to visit both the Böies and the Stones.
Avé Lallement, who would gladly have seen Johannes settled in
Hamburg as conductor of the Philharmonic, says, in a letter written
in the early spring of the year to Dr. Löwe of Zürich:
'We had the "Matthew Passion" here under Grund; Brahms
also was delighted, in spite of the defective performance.
He thinks of going to Vienna in the autumn; then I shall
be quite alone, but thank God I have learnt to know the
man so well. I have come a good piece forward through
him.'
The pianoforte quartets finished, the composer was now busy with
the great work which we know as a quintet for pianoforte and
strings. It was finished in its first form—a string quintet with two
violoncelli—by the end of the summer. When tried a year later by
Joachim and his colleagues, the effect of the work was found
insufficiently sonorous for its great material, and Brahms arranged it
as a sonata for two pianofortes, and subsequently as a quintet for
pianoforte and strings. We shall have occasion later on to make
particular mention of the first public, and of an early private,
performance of the sonata version.
Brahms and Dietrich met at the Rhine Festival given this year at
Cologne (June 8-10), where they made the artistic and personal
acquaintance of Frau Louise Dustmann, court chamber singer, and of
the court opera, Vienna, whom Brahms knew well in later years.
From Cologne they proceeded to Münster-am-Stein, taking lodgings
together near Frau Schumann, who was staying there with her
family. From Münster Dietrich wrote to his wife:
'The longer I am with Brahms, the more my affection and
esteem for him increase. His nature is equally lovable,
cheerful, and deep. He often teases the ladies, certainly,
by making jokes with a serious air which are frequently
taken in earnest, especially by Frau Schumann. This leads
to comical and frequently dangerous arguments, in which
I usually act as mediator, for Brahms is fond of
strengthening such misunderstandings, in order to have
the laugh on his side in the end. This to me attractive
humorous trait is, I think, the reason why he is so often
misunderstood. He can, however, be very quiet and
serious if necessary.'
Brahms and Dietrich composed industriously in the mornings; the
afternoons and evenings were occupied with excursions or music,
and at this time Brahms showed his friend an early version of the
first movement of his C minor Symphony, not completed until
fourteen years later. The six 'Magelone Romances' were pronounced
by Dietrich to be amongst the finest works yet produced by their
composer.
The Sextet in B flat, the Handel Variations, and the horns and harp
Songs for women's Chorus, were published this year by Simrock.
Two works in the hands of Rieter-Biedermann—the Marienlieder for
mixed Chorus and the Variations for Pianoforte Duet Op. 23—
appeared at the end of 1862 or the beginning of 1863.[95]
The Marienlieder, seven in number, to be sung a capella, are not
sacred compositions. They are settings of old texts founded upon
some of the medieval legends that grew up around the history of the
Virgin, and are delightfully fresh examples of the pure style of part-
writing of which Brahms had made himself a master. In spite of the
restricted means at the disposal of the composer who elects to
forego, for the nonce, all but the few diatonic harmonies alone
available in this style, there is a something about these attractive
little pieces which allows Brahms' individuality to be distinctly felt. If,
as is inevitable, they carry back the mind of the listener to the choral
music of the sixteenth century, they recall the style of the early
German, rather than of either of the Italian, schools. Perhaps the
most fascinating of the set is No. 2, entitled 'Mary's Church-going.'
Mary, on her way to church, comes to a deep lake, and, finding a
young boatman standing ready, requests him to ferry her over,
promising him whatever he may like best in return. The boatman
answers that he will do what she asks provided she will become his
housewife; but Mary, replying that she will swim across rather than
consent to the suggestion, jumps into the water. When she is half-
way to the other side, the church bells suddenly begin to ring,
loudly, softly, all together. Mary, on her safe arrival, kneels on a
stone in prayer, and the boatman's heart breaks. The first five verses
are composed strophically (each like the other) for two sopranos,
contralto, and tenor, in E flat minor, and are marked piano. The bass
enters with the sixth verse, composed in E flat major, and, whilst the
whole choir bursts into a jubilant forte, keeps up a movement in
concert, first with the tenor and then with the soprano, suggestive of
bell-ringing. The concluding words return to the setting of the first
five verses, and by this means the little composition is rounded into
definite shape.
The Variations are amongst the most beautiful of Brahms' many fine
achievements in this particular domain, and present for admiration
conspicuous qualities of their own arising from the opportunities
offered by their composition in duet form. The theme on which they
are founded is that supposed by Schumann to have been brought to
him in the night three weeks before his malady reached its crisis.
The work is dedicated to Fräulein Julie Schumann, the master's third
daughter.
And now, in a few weeks, the period of Brahms' career which is to
be especially associated with Hamburg was to close. He would gladly
have strengthened his ties with the city to which he was so proud to
belong, but, as we shall see, his compatriots would have none of
him. Twice in the coming years they passed him by, and when the
time at length arrived in which they would willingly have proclaimed
the world-famous composer as their own special prophet, his
interests and affections had become too deeply rooted within the
city that he made his second home to be capable of a second
transplantation.
Brahms quitted Hamburg for his first visit to Vienna on September 8.
That he expected to return speedily is evident from the lines sent by
him to Dietrich on the eve of his departure:
'Dear Friend,
'I am leaving on Monday for Vienna! I look forward to it
like a child.
'Of course I do not know how long I shall stay; we will
leave it open, and I hope we may meet some time during
the winter.
'The C minor Symphony is not ready; on the other hand, a
string quintet (2 v.celli) in F minor is finished. I should like
to send it you and hear what you have to say about it,
and yet I prefer to take it with me.
'Herewith my Handel Variations; the Marienlieder are not
yet here.
'Greet all the Oldenburg friends.
'Pray do not leave me quite without letters. You might
address for the present to Haslinger, or to Wessely and
Büsing.
'Heartiest farewell meanwhile, dear Albert, to you and
your wife.
'Your Johannes.'
'Father,' said Brahms, looking slyly at his father as he said good-bye,
'if things should be going badly with you, music is always the best
consolation; go and study my old "Saul"—you will find comfort
there.'

He had thickly interlarded the volume with bank-notes.[96]


It is highly interesting to possess a clear conception of Brahms'
achievements as a composer, and, therewith, of his exact title to
consideration at this important moment of his career. This will be
best obtained by a glance at the list of the chief completed works
with which he was to present himself in the city associated with the
most hallowed memories of his art. His departure for Vienna is by no
means to be regarded as coincident with the close of any one period
of his creative activity, though it emphatically marks the end, not
only of a chapter, but of the first book of his life.
List of Brahms' Chief Completed Works on his Departure for Vienna.
Pianoforte Solos:
Three Sonatas.
Scherzo.
Variations on Schumann's theme in F sharp minor.
Variations on an original theme.
Variations on a Hungarian song.
Variations and Fugue on Handel's theme.
Pianoforte Duet: Variations on a theme by Schumann.
Pianoforte with Orchestra: Concerto in D minor.
Orchestral: Two Serenades.
Chamber music:
Sextet in B flat for Strings.
Trio in B major for Pianoforte and Strings.
Quartet in G minor " " " "
Quartet in A major " " " "
Songs:
Five books (thirty songs).
'Magelone Romances' (first six).
Vocal Duets: two books.
Three Vocal Quartets.
Women's Chorus:
'Ave Maria.'
Part-songs.
Mixed Chorus:
Begräbnissgesang.
Marienlieder.
The 13th Psalm.
Motets.
Sacred Song.

The newly-finished String Quintet is not included in the list, as the


work was not published in this its first form. The Hungarian Dances,
as being arrangements, are also omitted.
APPENDICES
I.

MUSICAL FORM—ABSOLUTE MUSIC—PROGRAMME-MUSIC—BERLIOZ


AND WAGNER

The word Form, as applied to instrumental music, is synonymous


with Design. A movement is built up on a certain ground-plan, the
outlines of which are constructed according to some given
arrangement of keys, or melodies, or both, which secures symmetry
for the work and facilitates its presentment as a whole to the
intelligence of the hearer. A chief element in musical form is
recurrence, the simplest illustration of which—three sections of
which the third repeats the first (A, B, A)—is to be found in a vast
number of folk-melodies.
The main source to which the instrumental music of classical art
owes its primitive origin is the Folk-melody, whether of dance or of
song. This Folk-melody was entirely naïve, and as free from the
imitative or pictorial, as from the reflective, element. The dance-
melody was conditioned by the rhythm of the dance. The song-
melody, also rhythmical as distinct from declamatory, more or less
reflected the sentiment of the text; verses of a joyous character
naturally suggested joyous tunes, those of a plaintive character,
plaintive tunes; but the ideas constituting the melody were
essentially musical thoughts, and contained no attempt at pictorial
illustration of the subject of the words; the melody formed from
them was Absolute music.
In process of time these melodies came to be treated apart from
their text or their dance, and new ones were invented whose
primary object was not the dance or the song, but the gratification
of the ear and intelligence by the pleasing succession of musical
phrases. Instrumental movements were constructed, and these bore
unmistakable impress of their descent, since the ideas and series of
ideas forming them were rhythmical and symmetrical.
It is obviously impossible in the short space at our disposal even to
touch upon the history of the process by which early instrumental
pieces of a few bars have gradually developed into the elaborate
movements of classical art, but, by sketching as slightly as possible
two of the forms, one or other of which underlies the vast majority
of the instrumental works of modern classical music, we hope to
enable all our readers to follow the allusions to Form in our text,
which must be understood to include other forms than these, but
such as have in common with them the essential element of design
or symmetry.
The Rondo-form has been used by composers of almost all periods,
and has, in modern times, developed into two large varieties. The
idea from which it originated is best realized by reference to the old
rondeau dance-song, the design of which is simplicity itself. A short
melody sung several times in chorus was alternated with others
contributed by solo voices, which were sometimes called 'couplets,'
and which are now generally termed 'episodes.' The form required
two, and permitted any number, of episodes, each of which was
bound to furnish a new melody. The performance terminated as it
began, with the chorus. The form, therefore, may be thus
represented: A, B, A, C, A, ad libitum.
The reader will find many examples of the early eighteenth-century
instrumental Rondo in Couperin's 'Pièces de Clavecin,' published in
Paris in 1713, and edited for republication by Brahms (Chrysander's
'Denkmäler der Tonkunst'). With these he may compare the great
rondo-movement of Beethoven's Sonata in C major, Op. 53.
The so-called Sonata-form underlies the immense majority of the
first movements composed by the great masters of the last century
and a half—the first movements, not only of those works for
pianoforte solo or pianoforte and another instrument which are
called by the name sonata, but of trios, quartets, and so forth, and
of symphonies, which are, in fact, sonatas for orchestra.
A movement in Sonata-form consists of three essential parts—the
Statement or Exposition of themes, the 'thematic material'; their
Development; their Repetition. To these was formerly appended a
short Coda, which has gradually developed, and now frequently
extends to the dimensions of a fourth part.
The first part, the Statement, is itself divided into two sections, not
necessarily or even generally of equal duration, marked by difference
of tonality. The first is dominated by the tonic key of the movement.
It contains the First Subject, which may be either short and concise,
of sixteen or even eight bars only, or of several different paragraphs;
a principal idea and subordinate themes. The second section is
dominated by some other key; formerly, in a major movement by
that of the dominant, in a minor movement by that of the relative
major or dominant minor. It contains the Second Subject, a new
melody followed or not by subordinate themes. These two sections
are connected by a modulatory 'bridge passage,' which leads the ear
from the first to the second principal key of the Statement, and
which used generally to come to a pause on the dominant harmony
of the new key in preparation for the entry of the Second Subject.
The Statement closes, with or without a Codetta, in the key of the
Second Subject. Formerly it was invariably played twice, its
termination being followed by a double bar with repetition marks.
The second part of the movement, the Development, sometimes
called the Free Fantasia or the Working-out, is what its name
implies. It is constructed from the material of the Statement, which
the composer works or develops according to his fancy, using either
or both of his subjects, his bridge passage, his codetta, entire or in
part, alone or combined, with much or little modulation to near or
distant keys, just as he pleases. The Development part of the
movement is not visibly and mechanically cut off from what follows it
by a double bar like the Statement, nor does it end with a final
cadence, but usually closes with some sort of half-cadence—formerly
it was the typical one, a pause on the dominant—which leads to the
third part of the movement, the Repetition.
In this the Statement is repeated, modified by the circumstance that
both its sections are dominated by the tonic key of the movement, in
which the Second Subject as well as the First is heard, such
modulations as may have occurred in the Statement being
represented in the Repetition with the changes required by this fact.
The Coda is more often than not retrospective, but its character and
arrangement are at the discretion of the composer, provided that it
gives sufficient emphasis to the original key to leave the mind of the
hearer impressed with the tonality of the movement.
We have not troubled the reader in this short sketch with the
varieties or exceptions to be found in the works of the great
composers of the period indicated above. Their movements in this
form, whether we examine those of the simple sonatina or of the
complex symphony, will be found, broadly speaking, to conform to
our description. A very clear illustration of the outlines of Sonata-
form may be studied in the first movement of Beethoven's Sonata in
G major, Op. 14, No. 2.
The developed instrumental movements of classical art, capable of
stirring the highest aspirations of which the spirit of man is capable,
are, like the short pieces from which they have sprung, constructed
from 'musical ideas'—ideas, that is to say, which act upon the
nerves, emotions, intellect of the listener, directly through the sense
of sound, and are not dependent for their effect upon intermediate
mental translation into images perceptible to the mind's eye, the
vision of imagination. This does not mean that a composer of pure
music never is and never may be pictorial, but the cases in which he
is so are, as it were, accidental, and the pictorial element in a given
work is not of the essence of his art, but is something added to it,
something, moreover, which does not affect the value of the
composition as a work of art. A composer of Absolute music may
indeed, and often does, stimulate his imagination by recalling a
poem, a legend, a scene of nature or life; and either of these may
leave a more or less definite impress on his music; whilst a title or a
motto placed above a short pianoforte piece, an orchestral overture,
or, in very few cases, a symphony, may sometimes stimulate the
hearer's appreciation; but the music is not in such a case to be taken
as 'meaning' this or that in detail. The composer aims at making his
movement a work of art complete in itself, and relies for his effects
upon his musical thoughts and their treatment as such, though he
may be willing to let his hearers know that his fancy was encouraged
by extraneous aid.
The listener may, on the other hand, if it assist his enjoyment, attach
his own 'meaning' to what he hears, but he must understand that
this is relative to himself only. No one can assure him that his
'meaning' is right or wrong. The music as such should stand high
above such interpretations, and, if it is to fulfil its supreme destiny,
must speak directly to the soul in its own infinite language of sound,
infinite just because it is capable of transcending the defined objects
of sight.
Vocal forms have always necessarily been to a great extent
dependent on the text chosen for musical treatment. Nevertheless,
certain vocal forms have been developed—the aria, the ballad, the
lied, the ensemble—which, though freer than those of instrumental
music, have the common characteristics of symmetry more or less,
and of rhythmic melody as distinct from the mere accentuation of
the recitative.
The Art-song of the classical masters, whether for one or more
voices, mirrors, like its parent the Folk-song, the sentiment of the
text, but is not pictorial. Its instrumental accompaniment may, and
at times does, reflect or emphasize the suggestion of the words, but
it does not attempt to imitate or illustrate in detail the images which
they represent; or only in an insignificant number of instances,
which may be classed with the cases to which we have referred in
our remarks upon instrumental music.
A good deal of confusion prevailed in the mind of the general
musical public of the middle of the nineteenth century as to the
views held by the musicians of the New-German party, and it has not
been cleared away even at the present day. This has resulted chiefly
from the fact that, like many another body of radical reformers, they
were by no means at one as to the positive articles of their faith.
It is far from the desire of the present writer to enter into a lengthy
discussion of vexed controversies which time alone can settle. The
object of this appendix is simply to assist the general reader to
follow certain allusions and incidents in the text of the narrative, and
especially to make clear how it was that Brahms, an uncompromising
champion of musical tradition, whose very existence as an artist was
staked on the vitality of Absolute music, could deeply respect the art
of Wagner. With these ends only in view, it is proposed to limit the
few words to be said here to the attempt to show what the
fundamental difference was which separated the methods of Berlioz
and Wagner, the two giants of the Weimar party, in their efforts to
establish a basis for the Music of the Future so far as they conceived
this could be achieved by the closer union of the arts of instrumental
music and poetry.
Berlioz (1803-1869) has been accepted as the typical champion of
what is called Programme-music. The question as to what is to be
understood by this term, however, has become very difficult to
answer, because nowadays anything may become a programme or
supply a label. A poem, a romance, or a commonplace situation of
everyday life; an emotion, a series of emotions, or the individuality
of a man or woman; or, again, the emotion or mental action which a
certain personality may excite in another. If, however, we restrict the
question and examine only what meaning attaches to the term
Programme-music as applied to Berlioz's instrumental works, the
answer is that the composer is so intent on conveying, as an
essential part of his movements, definite and detailed ideas outside
the art of sound per se, which he finds in certain poems or plays or
narratives, that he not only places verbal headings above them, but
in many cases prefaces his works with an explanation minutely
describing the scenes which they are intended to represent point by
point, or the emotions that he desires to excite at successive steps
of their progress. Such detailed labels and expositions are what is
commonly termed the Programme.
However the purpose be described which Berlioz thus set himself to
fulfil, whether it be said that the music was to absorb or to clothe
the poem, to translate or reflect it, it is obvious that, if words have
any real meaning, its ultimate raison d'être was to be either imitative
or, at best, illustrative. Instrumental music necessarily becomes one
or the other the moment that material outside the domain of sound
is accepted as of its essence, and it is thereby debased from the
level of the fine art of sound. If it be said that the object of the
programme is to be a sort of guide-post to the emotions or
sentiments to which the music is addressed, the position becomes
worse, for the incapacity of the musician as such stands confessed.
The union of poetry and music in the sense of the instrumental
Programme composer is, from the point of view of the creator of
Absolute music, fatal, not only to the dignity, but to the vital force,
of both arts. The poem becomes a phantom, the music a
conundrum; the listener wastes his time and fancy in trying to fit
them together, and is without means of knowing how far he has
been successful, and the product of these processes is a something
which, in the words of Wagner, is neither fish nor fowl.
Whatever may be the ultimate fate of Berlioz's works, his immense
capacity, the extraordinary sensitiveness and force of his imagination
of tone-colour, and his phenomenal mastery of the resources of the
orchestra, have insured the survival of his name. If on no other
account, it will live as that of the creator of the complex art of
instrumentation in its modern sense, which was assimilated by
Wagner and developed by him in his dramas with vitalizing energy.
Very far removed from Berlioz's position was that of Wagner (1813-
1883), who not only implied his disbelief in Programme-music by his
practice, but expressly recorded it by direct avowal, and illustrated
his remarks by references to Berlioz's works.[97] If, as may be the
case, he received his first impulse as a reformer from Berlioz, he
clearly saw the fallacies in which the theories of the French musician
were involved, and avoided them in a sufficiently convincing manner.
He perceived, firstly, that the rejection of a future for Absolute music
was the same thing as the rejection of a future independent art of
sound; secondly, that a union of instrumental music with poetry in
Berlioz's sense meant that the function of music must be illustrative;
thirdly, that the subject to be illustrated by musical sound must be
presented to the perception of the audience in as real and
indubitable a manner as the illustration; that, as the musical
illustration was to be heard, so the subject illustrated must be seen.
Having boldly faced his premises, a splendid vision dawned upon his
imagination, and he shrank from no consequences which they
involved.
Rejecting the future existence not only of music, but also of poetry,
as a separate art, he predicted for both a future, as co-ordinate
elements with action and scenic effect, of a larger art, the drama,
the object of which he explained to be dramatic truth. Concentrating
his immense energies upon a reform of the stage, he adopted as his
fundamental principle that of a return, in the modern sense, to the
practice of Greek Tragedy. He substituted musical declamation of a
very highly-developed order for the rhythmic melody and
symmetrical movements of opera. Relinquishing the aria, the scena,
the regularly-constructed ensemble linked by recitativo secco, which
he conceived to be contradictory and obstructive to dramatic truth,
his method was to set his poem to a glorified species of recitative,
called by him the Melos, and to support and give it additional force
and vividness by a gorgeous illustrative orchestral accompaniment,
its other self. An important feature in his scheme, which is to be
regarded as his substitute for the Subject of traditional form, was
the adoption and development of the Leitmotif, a device employed to
some extent by Weber in 'Der Freischütz,' and by Berlioz. By it the
successive appearances on the stage of each prominent person of
the drama, and often the anticipation and remembrance as well as
the occurrence of an important situation, are signalized by a special
harmonic progression or a particular rhythmic figure. These became
in the case of Wagner, who was his own poet, something more than
mere labels or mottoes. Growing up in his mind with the progress of
his poem, his series of Leitmotive became for him, as it were, his
musical dramatis personæ. He felt them as an inseparable part of his
persons and events, and they became with these the framework on
which his works were constructed.
It must be clear to all unprejudiced minds that the principles which
guided the creator of the great music dramas were perfectly logical
and coherent, and that Wagner acted on them throughout the
course of his career, properly so called, with entire consistency and
with magnificent success. His error, and the error of his disciples, lay
in their arrogant and senseless propaganda of the Wagnerian articles
of faith, as expressions of the ultimate and universal principles of
art. Wagner went so far as to claim that Beethoven, recognising that
instrumental music had reached its natural term of existence, had
given practical expression to such a belief by setting Schiller's 'Ode
to Joy' in the finale of his ninth symphony. The assumption is
controverted by the facts that Beethoven composed the works
known as the posthumous string quartets, and sketched a purely
instrumental tenth symphony after the completion of the ninth.
The rejection of a future for Absolute music is, of course, purely
arbitrary. Wagner's achievements for the stage were transcendent,
but it is even conceivable that the progress of time may sooner or
later produce a composer able successfully to champion, in a
manner of his own, the cause of rhythmic melody, of traditional
form, on Wagner's own arena, on the stage itself.
If we examine the pretensions of the so-called larger art, the musical
Drama, versus the capacities of the several arts of poetry, of music,
of dramatic action, by the testimony of Wagner's own works, is it
possible to contend that these make for, and not against, the wholly
superfluous proposition from which he started as a reformer? One of
the reproaches frequently levelled by the New-Germans against
ante-Wagnerian opera was that its form hardly rose above the level
of an entertainment; that entertainment was its raison d'être. What,
however, is the ultimate result of the musical Dramas? Is it not also
entertainment—entertainment of a highly complex and luxurious
form, conceived and accomplished, certainly, in the most perfect and
perfectly consistent manner? The famous Dramas are gorgeous
stage poems; but are they so exceptionally and extraordinarily
elevating to the mind? They address the senses with exceptional
power. Could either of them replace amongst our highest
possessions a really great play, a great poem, a great symphony?
The art of sound, the art of music, is and remains the special art
divine because it is capable of reaching beyond the limited
impressions of which words are the symbols, and of suggesting the
infinite.
Let us be grateful for the splendid gifts which the genius of Wagner
has bestowed on the world. May the supreme art of music, however,
be always recognised as such. May a musical prophet again arise in
due time, capable of speaking with authority in its language—the
language of Haydn, Mozart, and Beethoven, of Schubert,
Mendelssohn, and Schumann, the language of Bach and of Brahms.

II.

THE MAGELONE ROMANCES

The story of the Count Peter of Provence and the beautiful


Magelone, Princess of Naples, which is associated with a well-known
ruin on the south coast of France, is said by Raynouard to have
formed the subject of a poem written towards the close of the
twelfth century by Bernhard de Trèves, Canon of Magelonne in
Languedoc. It was adapted as a prose romance not later than the
middle of the twelfth, and printed in at least five different editions
before the end of the fifteenth, century. Of these, rare copies are to
be found in some of the famous libraries of England and the
Continent. Two editions, copies of which are in the British Museum,
were issued by Maître Guillaume Le Roy. With slight differences of
spelling they begin:
'Au nom de notre seigneur ihesucrist, cy commēce listoyre du vaillant
chevalier pierre filz du cote de provēce et de la belle maguelonne
fille du roy de naples.'
The romance is constructed from the familiar elements of medieval
fiction—chivalry, religion and love—and has been translated at
various dates into almost every European language, Italian, Spanish,
Portuguese, Russian, Norse, etc. It has been republished in German
many times through the centuries since it was first done into that
language (probably in 1483), and was included by G. O. Marbach in
1838 in his popular series of tales (Volksbücher). That it was this
version of the story that found its way into Frau Löwenherz's library
and was read by Johannes and Lischen is proved beyond doubt by
its title, which is identical with that noted down by the present writer
from the lips of Frau Denninghoff, the 'Lischen' of our biography
—'Geschichte der schönen Magelone und dem Ritter Peter mit den
silbernen Schlüsseln'—and it seems probable that Marbach obtained
his tale from an edition published in 1661 at Nürnburg: 'Historia der
schönen Magelona, eines Königs Tochter von Neaples, und einem
Ritter, genannt Peter mit den silbernen Schlüsseln, eines Grafen
Sohn aus Provincia.' Of the many editions, fifteenth and up to the
nineteenth century, to which the author has had access, no other
contains in its title any mention of the silver keys.
Marbach's version is a fine one. Whilst he has modernized the old
romance in certain respects, he has kept, not only to the main
incidents of the tale, but to the quaint old dialogues which naïvely
portray the characters of the manly-hearted but rather weak-minded
Peter and the high-spirited, self-willed, yet tender Magelone.
Tieck's version, published in 1812 in the first volume of the
'Phantasus,' differs considerably, especially in its particulars of the
beginning and end of the romance, from the original details of the
story. In making his alterations, the poet seems to have been chiefly
concerned to eliminate the religious element from his narrative as far
as possible, and to provide opportunity for the introduction of
seventeen songs of which Brahms composed fifteen. The tale has
suffered considerably in his hands. The general atmosphere of
French medieval fiction, with its characteristic setting of sunrise and
sunset, flowers and birds, and, in parts, the wording of the old
romance, have, however, been preserved, and we may be grateful to
Tieck for the poems which have placed us in possession of Brahms'
beautiful song-cycle.
We propose to give an abridgment of his narrative up to a certain
point and to summarize ensuing details, which become prolix and
involved in all the versions. We shall insert only the first few lines of
each song.

How a Strange Singer came to the Court of Provence.

A long time ago, a Count reigned in Provence whose beautiful and


noble son grew up the joy of his parents. He was big and strong and
his shining fair hair flowed round his neck and shaded his tender,
youthful face. Then he was well proved in arms; no one in or beyond
the land managed the lance and sword as he, so that he was
admired by great and small, young and old, noble and simple. He
was often absent-minded as though meditating on some secret
desire, and many experienced people concluded that he must be in
love, but none of them would awaken him from his thoughts, for
they knew that love is like the vision of a dream, which is apt, if
disturbed, to vanish and return to its dwelling in the ether and the
golden mists of morning.
His father gave a great tournament to which many knights were
invited. It was a wonder to see how the tender youth hove the best
and strongest from their saddles. He was lauded by everyone, but
no praise made him proud; indeed he sometimes felt ashamed at
overcoming such great and worthy knights. Amongst the guests was
a singer who had seen many lands; he was no knight, but he
surpassed many nobles in insight and experience. He made friends
with Peter and praised him uncommonly, but concluded his talk with
these words: Sir Knight, if I might advise you, you should not remain
here, but should see other places and other men, to improve your
ideas and learn to associate the strange with the familiar. He took his
lute and sang,
No one yet hath rued the day
When on charger mounting
Youthful-strong he sped away,
Pain nor peril counting, etc.
The youth listened to the song: when it was at an end, he remained
awhile sunk in thought; then said: Yes, now I know what I want;
many variegated pictures pass through my mind. No greater joy for
a young knight than to ride through valley and over field. Here in the
morning sunshine stands a stately castle, there over the meadow
sounds the shepherd's shawm; a noble maiden flies by on a white
palfrey. Oh, I wish I were already on my good horse. Heated by
these new thoughts, he went at once to his mother's chamber where
he found his father also. Peter immediately sank on one knee and
made his request that his parents would allow him to travel and seek
adventures: for, thus he concluded his speech, he who only stays at
home keeps a narrow mind during his whole life, but by travel, one
learns to associate the strange with the familiar; therefore do not
refuse me your consent.
The old Count said: My son, your request appears to me unsuitable,
for you are my only heir; if I should die in your absence, what would
become of my land? But Peter kept to his request, whereat his
mother began to weep and said to him: Dear, only son, you have
never tasted trouble, and see only your beautiful hopes before you,
but remember that if you depart, a thousand difficulties may
confront you; you may be miserable and wish yourself back with us.
Peter remained humbly on his knees and answered: Beloved
parents, I cannot help it. My only wish is to travel into the wide
world, to experience pleasure and sorrow there and to return a
known and honoured man. For this you travelled in your youth, my
father, and brought home my mother from a strange land. Let me
seek a like fortune, I beg for this with tears.
He took the lute and sang the song which he had heard from the
minstrel, and at the end he wept bitterly. The parents were moved,
especially the mother; she said: Well, I, for my part, will give you my
blessing, dear son, for what you have said is true. The father also
rose and blessed him, and Peter was glad from his heart that he had
received his parents' consent.
Orders were given to prepare everything for his departure, and his
mother sent for him to come to her privately. She gave him three
precious rings and said: See, my son, I have kept these three
precious rings carefully from my youth. Take them with you and
treasure them, and if you find a maiden whom you love, and who is
inclined towards you, you may give them to her. He gratefully kissed
her hand, and the morning came on which he took leave.

How the Knight Peter departed from his Parents.

When Peter was ready to mount his horse, his father blessed him
again and said: My son, may good fortune ever accompany you so
that we may see you back again healthy and strong; think constantly
of the precepts I have impressed upon your tender youth; seek
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!

ebookname.com

You might also like