Professional Documents
Culture Documents
(Download PDF) Matlab Recipes A Problem Solution Approach 2Nd Edition Michael Paluszek Online Ebook All Chapter PDF
(Download PDF) Matlab Recipes A Problem Solution Approach 2Nd Edition Michael Paluszek Online Ebook All Chapter PDF
https://textbookfull.com/product/matlab-machine-learning-recipes-
a-problem-solution-approach-2nd-edition-michael-paluszek/
https://textbookfull.com/product/matlab-machine-learning-recipes-
a-problem-solution-approach-3rd-edition-michael-paluszek/
https://textbookfull.com/product/android-recipes-a-problem-
solution-approach-dave-smith/
https://textbookfull.com/product/raku-recipes-a-problem-solution-
approach-j-j-merelo/
C Recipes - A Problem-Solution Approach 1st Edition
Shirish Chavan
https://textbookfull.com/product/c-recipes-a-problem-solution-
approach-1st-edition-shirish-chavan/
https://textbookfull.com/product/javascript-recipes-a-problem-
solution-approach-1st-edition-russ-ferguson/
https://textbookfull.com/product/wxpython-recipes-a-problem-
solution-approach-1st-edition-mike-driscoll/
https://textbookfull.com/product/java-9-recipes-a-problem-
solution-approach-3rd-edition-josh-juneau/
https://textbookfull.com/product/spring-5-recipes-a-problem-
solution-approach-4th-edition-marten-deinum/
MATLAB
Recipes
A Problem-Solution Approach
—
Second Edition
—
Michael Paluszek
Stephanie Thomas
MATLAB Recipes
A Problem-Solution Approach
Second Edition
Michael Paluszek
Stephanie Thomas
MATLAB Recipes: A Problem-Solution Approach
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on
microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, com-
puter software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occur-
rence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the
benefit of the trademark owner, with no intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as
such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the
authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made.
The publisher makes no warranty, express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Steve Anglin
Development Editor: Matthew Moodie
Coordinating Editor: MarkPowers
Acknowledgements XVII
Introduction XIX
I Coding in MATLAB 1
1 Coding Handbook 3
MATLAB Language Primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Brief Introduction to MATLAB . . . . . . . . . . . . . . . . . . . . . . . . . 3
Everything Is a Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Strings Are Simple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Use Strict Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Cell Arrays Hold Anything and Everything . . . . . . . . . . . . . . . . . . 11
Optimize Your Code with Logical Arrays . . . . . . . . . . . . . . . . . . . 12
Use Persistent and Global Scope to Minimize Data Passing . . . . . . . . . . 12
Understanding Unique MATLAB Operators and Keywords . . . . . . . . . . 14
Harnessing the Power of Multiple Inputs and Outputs . . . . . . . . . . . . . 16
Use Function Handles for Efficiency . . . . . . . . . . . . . . . . . . . . . . 17
Numerics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Datastore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Tall Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Sparse Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Tables and Categoricals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Large MAT-files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Advanced Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
1.1 Initializing a Data Structure Using Parameters . . . . . . . . . . . . . . . . . 25
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
III
CONTENTS
IV
CONTENTS
V
CONTENTS
2 MATLAB Style 69
2.1 Developing Your Own MATLAB Style Guidelines . . . . . . . . . . . . . . 69
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
2.2 Writing Good Function Help . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.3 Overloading Functions and Utilizing varargin . . . . . . . . . . . . . . . 77
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
2.4 Adding Built-in Inputs and Outputs to Functions . . . . . . . . . . . . . . . 78
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
2.5 Adding Argument Checking to Functions . . . . . . . . . . . . . . . . . . . 80
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
2.6 Adding Dot Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
2.7 Smart Structuring of Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
2.8 Implementing MATLAB Command-Line Help for Folders . . . . . . . . . . 85
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
2.9 Publishing Code into Technical Reports . . . . . . . . . . . . . . . . . . . . 88
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
2.10 Integrating Toolbox Documentation into the MATLAB Help System . . . . . 93
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
VI
CONTENTS
3 Visualization 101
3.1 Plotting Data Interactively from the MATLAB Desktop . . . . . . . . . . . . 102
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3.2 Incrementally Annotate a Plot . . . . . . . . . . . . . . . . . . . . . . . . . 107
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
3.3 Create a Custom Plot Page with Subplot . . . . . . . . . . . . . . . . . . . . 109
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
3.4 Create a Heat Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
3.5 Create a Plot Page with Custom-Sized Axes . . . . . . . . . . . . . . . . . . 113
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
3.6 Plotting with Dates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
3.7 Generating a Color Distribution . . . . . . . . . . . . . . . . . . . . . . . . 118
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
3.8 Visualizing Data over 2D or 3D Grids . . . . . . . . . . . . . . . . . . . . . 120
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
3.9 Generate 3D Objects Using Patch . . . . . . . . . . . . . . . . . . . . . . . 123
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
VII
CONTENTS
VIII
CONTENTS
IX
CONTENTS
6 Classes 199
6.1 Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . 199
6.2 State Space Systems Base Class . . . . . . . . . . . . . . . . . . . . . . . . 201
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
6.3 State Space Systems Discrete Class . . . . . . . . . . . . . . . . . . . . . . 206
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
6.4 Using the State Space Class . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
6.5 Using a Mocking Framework . . . . . . . . . . . . . . . . . . . . . . . . . 209
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
II Applications 213
X
CONTENTS
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
7.6 Create Figures with Multiple Subplots . . . . . . . . . . . . . . . . . . . . . 230
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
8 Robotics 235
8.1 Creating a Dynamical Model of the SCARA Robot . . . . . . . . . . . . . . 235
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
8.2 Customize a Visualization Function for the Robot . . . . . . . . . . . . . . . 238
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
8.3 Using Numerical Search for Robot Inverse Kinematics . . . . . . . . . . . . 243
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
8.4 Developing a Control System for the Robot . . . . . . . . . . . . . . . . . . 246
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
8.5 Simulating the Controlled Robot . . . . . . . . . . . . . . . . . . . . . . . . 248
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
XI
CONTENTS
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
9.4 Simulating the Controlled Motor . . . . . . . . . . . . . . . . . . . . . . . . 270
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
XII
CONTENTS
12 Aircraft 327
12.1 Creating a Dynamical Model of an Aircraft . . . . . . . . . . . . . . . . . . 327
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
12.2 Equilibrium Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
12.3 Designing a Control System for an Aircraft . . . . . . . . . . . . . . . . . . 340
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
12.4 Plotting a 3D Trajectory for an Aircraft . . . . . . . . . . . . . . . . . . . . 342
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
12.5 Simulating the Controlled Aircraft . . . . . . . . . . . . . . . . . . . . . . . 346
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
12.6 Draw an Aircraft . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
XIII
CONTENTS
14 Automobiles 383
14.1 Automobile Dynamics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
14.2 Modeling the Automobile Radar . . . . . . . . . . . . . . . . . . . . . . . . 389
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
14.3 Automobile Autonomous Passing Control . . . . . . . . . . . . . . . . . . . 393
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
14.4 Automobile Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
14.5 Modeling an Automobile Suspension . . . . . . . . . . . . . . . . . . . . . 400
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
How It Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Bibliography 407
Index 409
XIV
About the Authors
XV
ABOUT THE AUTHORS
XVI
CHAPTER 1 CODING HANDBOOK
b{2} =
0
Using curly braces for access gives you the element data as the underlying type. When you
access elements of a cell array using parentheses, the contents are returned as another cell array,
rather than the cell contents. MATLAB help has a special section called Comma-Separated
Lists which highlights the use of cell arrays as lists. The code analyzer will also suggest more
efficient ways to use cell arrays, for instance:
Replace
a = {b{:} c};
with
a = [b {c}];
Cell arrays are especially useful for sets of strings, with many of MATLAB’s string search
functions optimized for cell arrays, such as strcmp.
Use iscell to identify cell array variables. Use deal to manipulate structure array and
cell array contents. Table 1.4 shows a selection of key cell array functions.
Function Purpose
cell Initialize a cell array
cellstr Create cell array from a character array
iscell Identify a cell array
iscellstr Identify a cell array containing only strings
celldisp Recursively display the contents of a cell array
11
Another random document with
no related content on Scribd:
15. by the words of the Lord] i.e. the king’s command was
recognised to be in accordance with the Divine will. Read by the
word; the plural words is probably only a textual error.
unto the inner part of the house] Render, within the house. The
reference is not to the Holy of Holies specially, but to the whole
interior of the house.
to the brook Kidron] The brook Kidron is the deep valley on the
east of Jerusalem separating it from the Mount of Olives; 2 Samuel
xv. 23; John xviii. 1. It was treated as an unclean spot, compare xv.
16.
The ritual of the sin offering is fully given in Leviticus iv. Ahaz had
broken the covenant, and Hezekiah’s sin offering was intended to
atone for the breach.
for the sanctuary] i.e. for the Temple (compare Leviticus xvi. 16),
but probably inclusive of the personnel of the Temple, i.e. the priests
and Levites, since otherwise they would have been passed over in
the great sin offering.
on the altar of the Lord] Not on the altar of Ahaz (2 Kings xvi.
11).
25‒30.
The Levitical Service of Music.
Chapter XXX.
1‒12 (not in 2 Kings).
Hezekiah Invites all Israel to keep the Passover.
From verse 2 it appears that this Passover took place in the first
year of Hezekiah while the Northern Kingdom was still standing. The
invitation to share in it at Jerusalem which Hezekiah is here (verse 1)
said to have sent to north Israel is opposed to all historic probability.
The Chronicler, however, was little likely to be troubled by that
difficulty, even if he had observed it (see note, verse 5). Furthermore
it is a plausible suggestion that the references to Ephraim,
Manasseh, etc. in verses 1, 10, 11, 18 really reflect conditions of the
Chronicler’s own circumstances, regarding which see the note on xv.
9. It is therefore a mistake to suggest that the date may be wrong
and that the Passover really took place in the sixth year of Hezekiah
after the fall of Samaria on the ground that the invitation would then
be more credible.
the remnant that are escaped of you out of the hand of the kings
of Assyria] The phrase applies most naturally to the final downfall of
Samaria through Shalmaneser and Sargon (722‒721 b.c.), but it is
possible of course to interpret it of the repeated disasters at the
hands of the Assyrians in the time of Tiglath-pileser some ten years
earlier.
the commandment of the king ... by the word of the Lord] The
king’s command was according to God’s command in the Law.
18. of Ephraim, etc.] The list of tribes given here does not agree
with the list in verse 11, but in both cases it may be that the
Chronicler merely wished by his list to designate men of the Northern
Kingdom as opposed to those of the Southern. He could not make
the distinction by using the term “Israel” here, for in Chronicles
“Israel” as a rule is not used in opposition to “Judah”; compare xi. 3
(note). (For a somewhat different view, see the head-note on verses
1‒12 and xv. 9.)