0% found this document useful (0 votes)
461 views

Programming Fundamentals Using MATLAB Analyze Data And Develop Algorithms 1st Edition by Michael Weeks B09NZC2XC1 pdf download

The document provides information about various educational ebooks and textbooks available for download at ebookball.com, including titles on programming fundamentals, data structures, and algorithms. It features specific books such as 'Programming Fundamentals Using MATLAB' by Michael Weeks and 'Data Structures and Algorithms in Python' by Michael Goodrich. Additionally, it includes contact information for MathWorks and details about MATLAB programming fundamentals.

Uploaded by

haalsndela
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
461 views

Programming Fundamentals Using MATLAB Analyze Data And Develop Algorithms 1st Edition by Michael Weeks B09NZC2XC1 pdf download

The document provides information about various educational ebooks and textbooks available for download at ebookball.com, including titles on programming fundamentals, data structures, and algorithms. It features specific books such as 'Programming Fundamentals Using MATLAB' by Michael Weeks and 'Data Structures and Algorithms in Python' by Michael Goodrich. Additionally, it includes contact information for MathWorks and details about MATLAB programming fundamentals.

Uploaded by

haalsndela
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Download the full version and explore a variety of ebooks

or text books at https://ebookball.com

Programming Fundamentals Using MATLAB Analyze Data


And Develop Algorithms 1st Edition by Michael
Weeks B09NZC2XC1

_____ Follow the link below to get your download now _____

https://ebookball.com/product/programming-fundamentals-
using-matlab-analyze-data-and-develop-algorithms-1st-
edition-by-michael-weeks-b09nzc2xc1-17618/

Access ebookball.com now to download high-quality


ebooks or textbooks
Here are some recommended products for you. Click the link to
download, or explore more at ebookball.com

Data Structures and Algorithms in Python 1st Edition by


Michael Goodrich, Roberto Tamassia, Michael Goldwasser
ISBN 9781118476734 1118476735
https://ebookball.com/product/data-structures-and-algorithms-in-
python-1st-edition-by-michael-goodrich-roberto-tamassia-michael-
goldwasser-isbn-9781118476734-1118476735-15762/

Problem Solving in Data Structures and Algorithms Using C


1st Edition by Hemant Jain ISBN 9352655915 9789352655915

https://ebookball.com/product/problem-solving-in-data-structures-and-
algorithms-using-c-1st-edition-by-hemant-jain-
isbn-9352655915-9789352655915-15768/

Problem Solving in Data Structures and Algorithms Using C


1st Edition by Hemant Jain ISBN 1540407306 9781540407306

https://ebookball.com/product/problem-solving-in-data-structures-and-
algorithms-using-c-1st-edition-by-hemant-jain-
isbn-1540407306-9781540407306-15866/

JavaScript Data Structures and Algorithms An Introduction


to Understanding and Implementing Core Data Structure and
Algorithm Fundamentals 1st Editon by Sammie Bae ISBN
1484239873 9781484239872
https://ebookball.com/product/javascript-data-structures-and-
algorithms-an-introduction-to-understanding-and-implementing-core-
data-structure-and-algorithm-fundamentals-1st-editon-by-sammie-bae-
isbn-1484239873-9781484239872-15798/
Web Animation using JavaScript Develop and Design 1st
Edition by Julian Shapiro ISBN 0134096703 9780134096704

https://ebookball.com/product/web-animation-using-javascript-develop-
and-design-1st-edition-by-julian-shapiro-
isbn-0134096703-9780134096704-16170/

Signal and System Analysis Using MATLAB 1st Edition by


Luis Chaparro 0123747163 9780123747167

https://ebookball.com/product/signal-and-system-analysis-using-
matlab-1st-edition-by-luis-chaparro-0123747163-9780123747167-17604/

Programming Fundamentals A Modular Structured Approach


using C++ 1st edition by Kenneth Leroy Busbee ISBN
1616100656 9781616100650
https://ebookball.com/product/programming-fundamentals-a-modular-
structured-approach-using-c-1st-edition-by-kenneth-leroy-busbee-
isbn-1616100656-9781616100650-25036/

Robotics Vision and Control Fundamental Algorithms In


MATLAB 2nd Edition by Peter Corke 3319544128 9783319544120

https://ebookball.com/product/robotics-vision-and-control-fundamental-
algorithms-in-matlab-2nd-edition-by-peter-
corke-3319544128-9783319544120-25276/

Data Structure Algorithms Using C A Practical


Implementation 1st edition by Sachi Nandan Mohanty,
Pabitra Kumar Tripathy 9781119752035 1119752035
https://ebookball.com/product/data-structure-algorithms-using-c-a-
practical-implementation-1st-edition-by-sachi-nandan-mohanty-pabitra-
kumar-tripathy-9781119752035-1119752035-18754/
MATLAB®
Programming Fundamentals

R2022b
How to Contact MathWorks

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.


1 Apple Hill Drive
Natick, MA 01760-2098
MATLAB Programming Fundamentals
© COPYRIGHT 1984–2022 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied
only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form
without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through
the federal government of the United States. By accepting delivery of the Program or Documentation, the government
hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer
software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014.
Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain
to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government) and shall
supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is
inconsistent in any respect with federal procurement law, the government agrees to return the Program and
Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be
trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for
more information.
Revision History
June 2004 First printing New for MATLAB 7.0 (Release 14)
October 2004 Online only Revised for MATLAB 7.0.1 (Release 14SP1)
March 2005 Online only Revised for MATLAB 7.0.4 (Release 14SP2)
June 2005 Second printing Minor revision for MATLAB 7.0.4
September 2005 Online only Revised for MATLAB 7.1 (Release 14SP3)
March 2006 Online only Revised for MATLAB 7.2 (Release 2006a)
September 2006 Online only Revised for MATLAB 7.3 (Release 2006b)
March 2007 Online only Revised for MATLAB 7.4 (Release 2007a)
September 2007 Online only Revised for MATLAB 7.5 (Release 2007b)
March 2008 Online only Revised for MATLAB 7.6 (Release 2008a)
October 2008 Online only Revised for MATLAB 7.7 (Release 2008b)
March 2009 Online only Revised for MATLAB 7.8 (Release 2009a)
September 2009 Online only Revised for MATLAB 7.9 (Release 2009b)
March 2010 Online only Revised for MATLAB 7.10 (Release 2010a)
September 2010 Online only Revised for MATLAB 7.11 (Release 2010b)
April 2011 Online only Revised for MATLAB 7.12 (Release 2011a)
September 2011 Online only Revised for MATLAB 7.13 (Release 2011b)
March 2012 Online only Revised for MATLAB 7.14 (Release 2012a)
September 2012 Online only Revised for MATLAB 8.0 (Release 2012b)
March 2013 Online only Revised for MATLAB 8.1 (Release 2013a)
September 2013 Online only Revised for MATLAB 8.2 (Release 2013b)
March 2014 Online only Revised for MATLAB 8.3 (Release 2014a)
October 2014 Online only Revised for MATLAB 8.4 (Release 2014b)
March 2015 Online only Revised for MATLAB 8.5 (Release 2015a)
September 2015 Online only Revised for MATLAB 8.6 (Release 2015b)
October 2015 Online only Rereleased for MATLAB 8.5.1 (Release 2015aSP1)
March 2016 Online only Revised for MATLAB 9.0 (Release 2016a)
September 2016 Online only Revised for MATLAB 9.1 (Release 2016b)
March 2017 Online only Revised for MATLAB 9.2 (Release 2017a)
September 2017 Online only Revised for MATLAB 9.3 (Release 2017b)
March 2018 Online only Revised for MATLAB 9.4 (Release 2018a)
September 2018 Online only Revised for MATLAB 9.5 (Release 2018b)
March 2019 Online only Revised for MATLAB 9.6 (Release 2019a)
September 2019 Online only Revised for MATLAB 9.7 (Release 2019b)
March 2020 Online only Revised for MATLAB 9.8 (Release 2020a)
September 2020 Online only Revised for MATLAB 9.9 (Release 2020b)
March 2021 Online only Revised for MATLAB 9.10 (Release 2021a)
September 2021 Online only Revised for MATLAB 9.11 (Release 2021b)
March 2022 Online only Revised for MATLAB 9.12 (Release 2022a)
September 2022 Online only Revised for MATLAB 9.13 (Release 2022b)
Contents

Language

Syntax Basics
1
Continue Long Statements on Multiple Lines . . . . . . . . . . . . . . . . . . . 1-2

Name=Value in Function Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3

Ignore Function Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4

Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5


Valid Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Conflicts with Function Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5

Case and Space Sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7

Choose Command Syntax or Function Syntax . . . . . . . . . . . . . . . . . . . 1-8


Command Syntax and Function Syntax . . . . . . . . . . . . . . . . . . . . . . . 1-8
Avoid Common Syntax Mistakes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
How MATLAB Recognizes Command Syntax . . . . . . . . . . . . . . . . . . . 1-9

Resolve Error: Undefined Function or Variable . . . . . . . . . . . . . . . . . 1-11


Issue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11
Possible Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11

Program Components
2
MATLAB Operators and Special Characters . . . . . . . . . . . . . . . . . . . . 2-2
Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Relational Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
String and Character Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . 2-16

Array vs. Matrix Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20
Array Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20
Matrix Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22

v
Compatible Array Sizes for Basic Operations . . . . . . . . . . . . . . . . . . 2-25
Inputs with Compatible Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25
Inputs with Incompatible Sizes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-27
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-27

Array Comparison with Relational Operators . . . . . . . . . . . . . . . . . . 2-30


Array Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
Logic Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-32

Operator Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33


Precedence of AND and OR Operators . . . . . . . . . . . . . . . . . . . . . . 2-33
Overriding Default Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-33

Average Similar Data Points Using a Tolerance . . . . . . . . . . . . . . . . 2-35

Group Scattered Data Using a Tolerance . . . . . . . . . . . . . . . . . . . . . . 2-37

Bit-Wise Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39

Perform Cyclic Redundancy Check . . . . . . . . . . . . . . . . . . . . . . . . . . 2-45

Conditional Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48

Loop Control Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-50

Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52


What Is a Regular Expression? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-52
Steps for Building Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-53
Operators and Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56

Lookahead Assertions in Regular Expressions . . . . . . . . . . . . . . . . . 2-64


Lookahead Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-64
Overlapping Matches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-64
Logical AND Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65

Tokens in Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-67


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-67
Multiple Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-69
Unmatched Tokens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-70
Tokens in Replacement Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-70
Named Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-71

Dynamic Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-73


Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-73
Dynamic Match Expressions — (??expr) . . . . . . . . . . . . . . . . . . . . . 2-74
Commands That Modify the Match Expression — (??@cmd) . . . . . . 2-74
Commands That Serve a Functional Purpose — (?@cmd) . . . . . . . . 2-75
Commands in Replacement Expressions — ${cmd} . . . . . . . . . . . . 2-77

Comma-Separated Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-80


What Is a Comma-Separated List? . . . . . . . . . . . . . . . . . . . . . . . . . 2-80
Generating a Comma-Separated List . . . . . . . . . . . . . . . . . . . . . . . . 2-80
Assigning Output from a Comma-Separated List . . . . . . . . . . . . . . . 2-82
Assigning to a Comma-Separated List . . . . . . . . . . . . . . . . . . . . . . . 2-82
How to Use Comma-Separated Lists . . . . . . . . . . . . . . . . . . . . . . . . 2-83

vi Contents
Fast Fourier Transform Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-86
Troubleshooting Operations with Comma-Separated Lists . . . . . . . . 2-86

Alternatives to the eval Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-91


Why Avoid the eval Function? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-91
Variables with Sequential Names . . . . . . . . . . . . . . . . . . . . . . . . . . 2-91
Files with Sequential Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-92
Function Names in Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-92
Field Names in Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-93
Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-93

Classes (Data Types)

Overview of MATLAB Classes


3
Fundamental MATLAB Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

Detect States of Variables Using is* Functions . . . . . . . . . . . . . . . . . . 3-5

Numeric Classes
4
Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Integer Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Creating Integer Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Arithmetic Operations on Integer Classes . . . . . . . . . . . . . . . . . . . . . 4-4
Largest and Smallest Values for Integer Classes . . . . . . . . . . . . . . . . 4-4

Floating-Point Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6


Double-Precision Floating Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Single-Precision Floating Point . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Creating Floating-Point Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
Arithmetic Operations on Floating-Point Numbers . . . . . . . . . . . . . . 4-8
Largest and Smallest Values for Floating-Point Classes . . . . . . . . . . . 4-9
Accuracy of Floating-Point Data . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
Avoiding Common Problems with Floating-Point Arithmetic . . . . . . 4-11

Create Complex Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-14

Infinity and NaN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15


Infinity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15
NaN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-15

Identifying Numeric Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-17

vii
Display Format for Numeric Values . . . . . . . . . . . . . . . . . . . . . . . . . . 4-18

Integer Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20

Single Precision Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27

The Logical Class


5
Find Array Elements That Meet a Condition . . . . . . . . . . . . . . . . . . . . 5-2

Reduce Logical Arrays to Single Value . . . . . . . . . . . . . . . . . . . . . . . . 5-6

Characters and Strings


6
Text in String and Character Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2

Create String Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5

Cell Arrays of Character Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-12


Create Cell Array of Character Vectors . . . . . . . . . . . . . . . . . . . . . . 6-12
Access Character Vectors in Cell Array . . . . . . . . . . . . . . . . . . . . . . 6-12
Convert Cell Arrays to String Arrays . . . . . . . . . . . . . . . . . . . . . . . . 6-13

Analyze Text Data with String Arrays . . . . . . . . . . . . . . . . . . . . . . . . . 6-15

Test for Empty Strings and Missing Values . . . . . . . . . . . . . . . . . . . . 6-20

Formatting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24


Fields of the Formatting Operator . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24
Setting Field Width and Precision . . . . . . . . . . . . . . . . . . . . . . . . . . 6-28
Restrictions on Using Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-30

Compare Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-32

Search and Replace Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-37

Build Pattern Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-40

Convert Numeric Values to Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-45

Convert Text to Numeric Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-48

Unicode and ASCII Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-52

Hexadecimal and Binary Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-54

viii Contents
Frequently Asked Questions About String Arrays . . . . . . . . . . . . . . . 6-58
Why Does Using Command Form With Strings Return An Error? . . 6-58
Why Do Strings in Cell Arrays Return an Error? . . . . . . . . . . . . . . . 6-59
Why Does length() of String Return 1? . . . . . . . . . . . . . . . . . . . . . . 6-59
Why Does isempty("") Return 0? . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-60
Why Does Appending Strings Using Square Brackets Return Multiple
Strings? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-61

Update Your Code to Accept Strings . . . . . . . . . . . . . . . . . . . . . . . . . 6-63


What Are String Arrays? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-63
Recommended Approaches for String Adoption in Old APIs . . . . . . 6-63
How to Adopt String Arrays in Old APIs . . . . . . . . . . . . . . . . . . . . . 6-65
Recommended Approaches for String Adoption in New Code . . . . . 6-65
How to Maintain Compatibility in New Code . . . . . . . . . . . . . . . . . . 6-66
How to Manually Convert Input Arguments . . . . . . . . . . . . . . . . . . 6-67
How to Check Argument Data Types . . . . . . . . . . . . . . . . . . . . . . . . 6-67
Terminology for Character and String Arrays . . . . . . . . . . . . . . . . . 6-69

Dates and Time


7
Represent Dates and Times in MATLAB . . . . . . . . . . . . . . . . . . . . . . . 7-2

Specify Time Zones . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-5

Convert Date and Time to Julian Date or POSIX Time . . . . . . . . . . . . 7-7

Set Date and Time Display Format . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10


Formats for Individual Date and Duration Arrays . . . . . . . . . . . . . . 7-10
datetime Display Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-10
duration Display Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-11
calendarDuration Display Format . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12
Default datetime Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-12

Generate Sequence of Dates and Time . . . . . . . . . . . . . . . . . . . . . . . 7-14


Sequence of Datetime or Duration Values Between Endpoints with
Step Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-14
Add Duration or Calendar Duration to Create Sequence of Dates . . 7-16
Specify Length and Endpoints of Date or Duration Sequence . . . . . 7-17
Sequence of Datetime Values Using Calendar Rules . . . . . . . . . . . . 7-17

Share Code and Data Across Locales . . . . . . . . . . . . . . . . . . . . . . . . . 7-20


Write Locale-Independent Date and Time Code . . . . . . . . . . . . . . . . 7-20
Write Dates in Other Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21
Read Dates in Other Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-21

Extract or Assign Date and Time Components of Datetime Array . . 7-23

Combine Date and Time from Separate Variables . . . . . . . . . . . . . . 7-26

Date and Time Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-28

ix
Compare Dates and Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-33

Plot Dates and Times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-36

Core Functions Supporting Date and Time Arrays . . . . . . . . . . . . . . 7-47

Convert Between Text and datetime or duration Values . . . . . . . . . 7-48

Replace Discouraged Instances of Serial Date Numbers and Date


Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-57
Convert Serial Date Numbers and Date Strings . . . . . . . . . . . . . . . 7-57
Replace Functions That Use Date Numbers . . . . . . . . . . . . . . . . . . 7-57
Discouraged Syntaxes for Date and Time Components . . . . . . . . . . 7-61
Guidelines for Updating Your Own Functions . . . . . . . . . . . . . . . . . 7-62

Carryover in Date Vectors and Strings . . . . . . . . . . . . . . . . . . . . . . . . 7-64

Converting Date Vector Returns Unexpected Output . . . . . . . . . . . . 7-66

Categorical Arrays
8
Create Categorical Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-2

Convert Text in Table Variables to Categorical . . . . . . . . . . . . . . . . . . 8-6

Plot Categorical Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-10

Compare Categorical Array Elements . . . . . . . . . . . . . . . . . . . . . . . . 8-16

Combine Categorical Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-19

Combine Categorical Arrays Using Multiplication . . . . . . . . . . . . . . 8-22

Access Data Using Categorical Arrays . . . . . . . . . . . . . . . . . . . . . . . . 8-24


Select Data By Category . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-24
Common Ways to Access Data Using Categorical Arrays . . . . . . . . . 8-24

Work with Protected Categorical Arrays . . . . . . . . . . . . . . . . . . . . . . 8-30

Advantages of Using Categorical Arrays . . . . . . . . . . . . . . . . . . . . . . 8-34


Natural Representation of Categorical Data . . . . . . . . . . . . . . . . . . 8-34
Mathematical Ordering for Character Vectors . . . . . . . . . . . . . . . . . 8-34
Reduce Memory Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-34

Ordinal Categorical Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-36


Order of Categories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-36
How to Create Ordinal Categorical Arrays . . . . . . . . . . . . . . . . . . . 8-36
Working with Ordinal Categorical Arrays . . . . . . . . . . . . . . . . . . . . 8-38

Core Functions Supporting Categorical Arrays . . . . . . . . . . . . . . . . 8-39

x Contents
Tables
9
Create Tables and Assign Data to Them . . . . . . . . . . . . . . . . . . . . . . . 9-2

Add and Delete Table Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-9

Add, Delete, and Rearrange Table Variables . . . . . . . . . . . . . . . . . . . 9-12

Clean Messy and Missing Data in Tables . . . . . . . . . . . . . . . . . . . . . . 9-18

Modify Units, Descriptions, and Table Variable Names . . . . . . . . . . 9-24

Add Custom Properties to Tables and Timetables . . . . . . . . . . . . . . 9-27

Access Data in Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-32


Summary of Table Indexing Syntaxes . . . . . . . . . . . . . . . . . . . . . . . 9-32
Table Indexing with Specified Rows and Variables . . . . . . . . . . . . . 9-37
Find Rows Where Values Meet Logical Conditions . . . . . . . . . . . . . 9-41
Dot Notation with Any Variable Name or Expression . . . . . . . . . . . . 9-44
Extract Data from Specified Rows and Variables . . . . . . . . . . . . . . . 9-46

Calculations on Data in Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-48

Split Data into Groups and Calculate Statistics . . . . . . . . . . . . . . . . 9-56

Perform Calculations by Group in Table . . . . . . . . . . . . . . . . . . . . . . 9-59

Advantages of Using Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-71

Grouping Variables To Split Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-76


Grouping Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-76
Group Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-76
The Split-Apply-Combine Workflow . . . . . . . . . . . . . . . . . . . . . . . . . 9-77
Missing Group Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-77

Changes to DimensionNames Property in R2016b . . . . . . . . . . . . . . 9-79

Data Cleaning and Calculations in Tables . . . . . . . . . . . . . . . . . . . . . 9-81

Grouped Calculations in Tables and Timetables . . . . . . . . . . . . . . . . 9-99

Timetables
10
Create Timetables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2

Resample and Aggregate Data in Timetable . . . . . . . . . . . . . . . . . . . 10-5

Combine Timetables and Synchronize Their Data . . . . . . . . . . . . . . 10-8

xi
Retime and Synchronize Timetable Variables Using Different
Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-14

Select Times in Timetable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-19

Clean Timetable with Missing, Duplicate, or Nonuniform Times


.................................................... 10-27

Using Row Labels in Table and Timetable Operations . . . . . . . . . . 10-36

Loma Prieta Earthquake Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 10-41

Preprocess and Explore Time-Stamped Data Using timetable . . . 10-51

Add Events from External Data to Timetable . . . . . . . . . . . . . . . . . 10-71

Find Events in Timestamped Data . . . . . . . . . . . . . . . . . . . . . . . . . . 10-83

Structures
11
Structure Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Create Scalar Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Access Values in Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-2
Index into Nonscalar Structure Array . . . . . . . . . . . . . . . . . . . . . . . 11-4

Concatenate Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-8

Generate Field Names from Variables . . . . . . . . . . . . . . . . . . . . . . . 11-10

Access Data in Nested Structures . . . . . . . . . . . . . . . . . . . . . . . . . . 11-11

Access Elements of a Nonscalar Structure Array . . . . . . . . . . . . . . 11-13

Ways to Organize Data in Structure Arrays . . . . . . . . . . . . . . . . . . . 11-15


Plane Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-15
Element-by-Element Organization . . . . . . . . . . . . . . . . . . . . . . . . 11-16

Memory Requirements for Structure Array . . . . . . . . . . . . . . . . . . 11-18

Cell Arrays
12
What Is a Cell Array? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-2

Create Cell Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3

Access Data in Cell Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5

xii Contents
Add Cells to Cell Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-8

Delete Data from Cell Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10

Combine Cell Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11

Pass Contents of Cell Arrays to Functions . . . . . . . . . . . . . . . . . . . . 12-12

Preallocate Memory for Cell Array . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16

Cell vs. Structure Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-17

Multilevel Indexing to Access Parts of Cells . . . . . . . . . . . . . . . . . . 12-21

Function Handles
13
Create Function Handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
What Is a Function Handle? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
Creating Function Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
Anonymous Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-3
Arrays of Function Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
Saving and Loading Function Handles . . . . . . . . . . . . . . . . . . . . . . 13-4

Pass Function to Another Function . . . . . . . . . . . . . . . . . . . . . . . . . . 13-5

Call Local Functions Using Function Handles . . . . . . . . . . . . . . . . . 13-6

Compare Function Handles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-8

Dictionaries
14
Map Data with Dictionaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-2

Dictionaries and Custom Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6


Hash Equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-6
Overload keyHash and keyMatch for Custom Classes . . . . . . . . . . . 14-6

Map Containers
15
Overview of Map Data Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-2

xiii
Description of Map Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4
Properties of Map Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4
Methods of Map Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-4

Create Map Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-6


Construct Empty Map Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-6
Construct Initialized Map Object . . . . . . . . . . . . . . . . . . . . . . . . . . 15-6
Combine Map Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-7

Examine Contents of Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-8

Read and Write Using Key Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9


Read From Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9
Add Key/Value Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10
Build Map with Concatenation . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-10

Modify Keys and Values in Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13


Remove Keys and Values from Map . . . . . . . . . . . . . . . . . . . . . . . . 15-13
Modify Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-13
Modify Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-14
Modify Copy of Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-14

Map to Different Value Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15


Map to Structure Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-15
Map to Cell Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-16

Combining Unlike Classes


16
Valid Combinations of Unlike Classes . . . . . . . . . . . . . . . . . . . . . . . . 16-2

Combining Unlike Integer Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3


Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-3
Example of Combining Unlike Integer Sizes . . . . . . . . . . . . . . . . . . 16-3
Example of Combining Signed with Unsigned . . . . . . . . . . . . . . . . . 16-4

Combining Integer and Noninteger Data . . . . . . . . . . . . . . . . . . . . . 16-5

Combining Cell Arrays with Non-Cell Arrays . . . . . . . . . . . . . . . . . . 16-6

Empty Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-7

Concatenation Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16-8


Combining Single and Double Types . . . . . . . . . . . . . . . . . . . . . . . . 16-8
Combining Integer and Double Types . . . . . . . . . . . . . . . . . . . . . . . 16-8
Combining Character and Double Types . . . . . . . . . . . . . . . . . . . . . 16-8
Combining Logical and Double Types . . . . . . . . . . . . . . . . . . . . . . . 16-8

xiv Contents
Using Objects
17
Copying Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
Two Copy Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
Handle Object Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
Value Object Copy Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
Handle Object Copy Behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
Testing for Handle or Value Class . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5

Defining Your Own Classes


18

Scripts and Functions

Scripts
19
Create Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-2

Add Comments to Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-3

Create and Run Sections in Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5


Divide Your File into Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-5
Run Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-6
Navigate Between Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-7
Behavior of Sections in Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 19-8
Behavior of Sections in Loops and Conditional Statements . . . . . . . 19-8

Scripts vs. Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-10

Add Functions to Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19-12


Create a Script with Local Functions . . . . . . . . . . . . . . . . . . . . . . 19-12
Run Scripts with Local Functions . . . . . . . . . . . . . . . . . . . . . . . . . 19-12
Restrictions for Local Functions and Variables . . . . . . . . . . . . . . . 19-13
Access Help for Local Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 19-13

Live Scripts and Functions


20
What Is a Live Script or Function? . . . . . . . . . . . . . . . . . . . . . . . . . . . 20-2
Differences with Plain Code Scripts and Functions . . . . . . . . . . . . . 20-3

xv
Other documents randomly have
different content
From Sciagraph of Various Objects. p. 130.
By Prof. Terry, U. S. Naval Academy.
11. Glow by Discharge. Glow Changed to Spark. Motion of Air.
Continuous Discharge During Glow. The glow was most easily obtained
in rarefied air. The electrodes were of metal rods about .2 of an inch
in diameter. He also obtained a glow in the open air by means of one
or both of the small rods. He noticed some peculiarities of the glow.
In the first place, it occurred in all gases and slightly in oil of
turpentine. It was accompanied by a motion of the gas, either
directly from the light or towards it. He was unable to analyze the
glow into visible elementary intermittent discharges, nor could he
obtain any evidence of such an intermittent action, § 8a. No sound
was produced even in open air. § 9. He was able to change the
brush into a glow by aiding the formation of a current of air at the
extremity of the rod. He also changed the glow into a brush by a
current of air, or by influencing the inductive action near the glow.
The presentation of a sharp point assisted in sustaining or
sometimes even in producing the glow; so also did rarefaction of the
air. The condensation of the air, or the approach of a large surface
tended to change the glow into a brush, and sometimes into a
spark. Greasing the end of the wire caused the glow to change into
a brush.

12. Lullin’s Experiment. Spark. Penetrating Power. Passage Through


Solids. Encyclo. Brit. Article Electricity. He placed a piece of
cardboard between two electrodes and discovered that a spark
penetrated the material and left a hole with burnt edges. When the
electrodes were not exactly opposite each other, the perforation
occurred in the neighborhood of the negative pole. Later
experiments have shown that a glass plate, 5 or 6 cm. in thickness,
can be punctured by the spark of a large induction coil. The plate
should be large enough to prevent the spark from going around the
edges. The spark is inclined, also, to spread over the surface of the
glass instead of piercing it, § 24. Glass has been cracked by the
spark in some experiments.
13. Fage’s Experiment. Spark. Penetrating Glass. Holes Close Together.
Practical Application. La Nature, 1879. Nature, Dec. 26, 1879, p. 189.
The length of the spark from the secondary coil in air was 12 cm.
One terminal of the secondary passed through an ebonite plate (18
cm. × 12) and touched the glass. Olive oil was spread around said
terminal (§ 11 at end), and served to insulate the same. Oil dielectric
in this connection originally employed at least prior to 1870.
Remembered by Prof. Anthony as far back as 1872, who often
performed the experiment according to instructions contained in a
publication. The other terminal of the secondary coil was brought
against the glass opposite the first terminal. The spark was then
passed and the glass perforated, § 12. By pushing the glass along to
successive positions and passing the spark at each movement, holes
could be made very close together. In Nature, of 1896, the author
noticed that certain manufacturers were introducing glass perforated
with invisible holes to be used for windows as a means of ventilation
without strong draughts. Perhaps the fine holes were made by
means of the electric spark.

14. Knochenhaurer’s Experiments. Conducting Power of Gas. Spark.


Penetrating Power. Relation of E. M. F. to Pressure of Gas. 1834. Pogg.
Ann., Vol. LVII., and Gordon, Vol. II. Boltzmann’s experiment (Pogg.
Ann., CLV., ’75), and calculation indicated that a gas at ordinary
pressure and temperature must have a specific resistance at least
1026 times that of copper. Pogg. Ann., CLV., ’75. Sir William Thomson
(Kelvin) confirmed this limit for steam, and Maxwell the same for
mercury and sodium vapor, steam and air. From Maxwell’s MSS.
Herwig was not sure but that the Bunsen burner flame and mercury
vapor conducted. He allowed for the conductivity of the walls of the
glass container. Braun treated of the conductivity of flames. Pogg.
Ann., ’75.

14a. Varley found that 323 Daniel cells only just initiated a current
through a hydrogen Geissler tube, and only 308 cells continued the
current after once started. Knochenhaurer found that Harris’ (Phil.
Trans., 1834) law did not hold exactly true, and that the ratio
between the E. M. F. and the air pressure becomes greater and
greater as the pressure becomes less and less. Harris thought the
ratio was constant. The limits of his pressures were from 3 to 27.04
inches of mercury. Stated in other words, his results were the same
as those of Harris and Masson (Ann. de Chimie, XXX., 3rd Se.),
except that a small constant quantity should be added. § 16.

15. Gordon’s Experiment. Dust Particles Hasten Discharge. Gordon,


Vol. II. Other experimenters had investigated the phenomena of the
electric spark with different densities of the dielectric by a spark
produced by a frictional or an influence machine, or, in a few cases,
by powerful batteries without coils, while Gordon claims to be the
first to carry out these experiments with an induction coil. He
observed that when the discharging limit was nearly reached, small
circumstances, such as a grain of dust or a rusting of the terminal by
a former discharge, would cause the discharge to take place at a
lower E. M. F., which should be allowed for.

16. Kelvin’s Experiment. Proc. R. So., 1860. Encyclo. Brit., Art. Elect.
He used as the terminals, two plates. One of them was perfectly
plane, while the other had a curvature of a very long radius. The
object of this arrangement was to obtain a definite length of spark
for each discharge. The plates were gradually moved away until the
spark would no longer pass, and the reading of the distance was
noted. The law which he found cannot well be expressed in the form
of a rule or principle, because it is of a rather intricate nature, but a
discovery resulted, namely in the case where the distance was
greater, the dielectric strength was smaller for respective distances
of .00254 and .535 cm. Many theoretical considerations in reference
to this matter have been presented, notably that of Maxwell in his
treatise on Electricity and Magnetism, Vol. I.
17. Cailletet’s Experiment. Spark. Penetrating Power. High Pressures.
Increased Dielectric Strength. Mascart, Vol. I. He experimented with
dry gas up as high as pressures of 700 lbs. per sq. inch. He found
that the dielectric strength continues to increase with increase of
pressure. He used about 15 volts in the primary and a powerful
induction coil. The dielectric strength was so great that at the
maximum pressure named above, the spark would not pass between
the electrodes when only .05 mm. apart. § 25 and 11, near end.

18. Faraday’s Experiment. Discharges in Different Chemical Gases


Variably Resisted. Exper. Res. Phil. Trans., Se. XII., Jan. ’36. Faraday
passed on from the consideration of the effect of pressure,
temperature, etc., and wondered whether there would be any
difference in the law according to what gas was used. He arranged
apparatus so that he could know, with air as a standard, whether
another gas had a greater or less dielectric power. (Cavendish before
him had noticed a difference.) He tabulated the results. They
exhibited the following facts, namely that gas, when employed as
dielectrics, depend for their power upon their chemical nature. § 10.
Hydrochloric acid gas was found to have three times the dielectric
strength of hydrogen, and more than twice that of oxygen, nitrogen
or air; therefore the law did not follow that of specific gravities nor
atomic weights. See also De la Rue, Proc. Royal So., XXVI., p. 227.

19. Thomson’s Experiments. Gas as a Conductor. Visible Indication by


Discharge. Nature, Lon., Aug. 23, ’94, p. 409; Jan. 31, ’95, p. 332,
and other references cited below. Lec. Royal Inst. Proc. Brit. Asso.,
Aug. 16, ’94. In making comparisons, things of like nature should be
considered. Take, for example, gas at .01 m. The number of
molecules in such a rarefied atmosphere is comparatively small,
while in an electrolyte there are molecules sufficient in number to
produce 15,000 lbs. of pressure, if imagined in the gaseous state
within the same space. By an experiment and rough calculation,
Prof. J. J. Thomson, F.R.S., calculated that the conductivity of a gas
estimated per molecule is about 10 million times that of an
electrolyte, for example, sulphuric acid. § 14. This is greater than the
molecular conductivity of the best conducting metals. The
experiment which is illustrated in Fig. IV. was a second experiment
which did not serve as a basis for calculation, but exhibited very
strikingly to the eye that gases having different pressures have
different conductivities. For this apparatus he had two concentric
bulbs, as indicated, one being contained within the other. The inner
one had air rarefied to the luminous point. The outer one had a
vacuum as high as it was practical to make it, and contained in a
projection a drop of mercury, which, when heated, would gradually
increase the pressure. Two Leyden jars were employed, and their
outer coatings were connected to the coil which is seen surrounding
the outer bulb, and the inner coatings were connected to the coils of
a Wimshurst machine. The operation was as follows: When the
mercury was cold, that is, with a high vacuum in the outer
compartment, a bright discharge passed through the inner bulb,
while the outer bulb was dark. When the mercury was heated, the
outer bulb was bright, and the inner one was almost dark. By well-
known principles of conductors and non-conductors, the operation
was explained by Prof. Thomson, who assumed that the gas in the
outer bulb is a conductor; then, at each spark will the alternating
current in the coil induce currents of an opposite direction in the
gas, which will become luminous, as occurred when the mercury was
heated. The currents circulating in the gas act as a shield to the
induction of the currents in the inner bulb. However, with the
vacuum exceedingly high in the outer bulb, the air therein being a
non-conductor comparatively, or for the given E. M. F., does not
prevent the discharge through the inner bulb, which becomes,
therefore, luminous. He next compared the dielectric power of a gas,
a liquid and a solid. He found that the E. M. F. had to be raised, in
order to produce the discharge,—higher in the liquid than in the gas,
and higher in the solid than in the fluid. § 12.
20. Boltzmann, Gibson, Barclay, Hopkinson and
Gladstone’s Experiments. Square Root of the Dielectric
Capacity Equal to the Refractive Index. Phil. Trans., 1871,
p. 573. Maxwell, Vol. II., § 788. Maxwell has argued
elaborately upon results of some of the above
experimenters upon the theory that the luminiferous
IV. ether is the medium for transmission of electricity, light
and magnetism; therefore he predicted that the
relation stated in the title above should exist. He acknowledged that
the relation is sufficiently near a constant to show in connection with
other results, especially those obtained, that his theory is probably
correct.

21. PLÜCKER’s Experiment. Hermetically Sealed Vacuum Tube. Encycl.


Brit., vol. 8, p. 64. Pogg. Ann., 1858, and vol. CXXXVI, 1869.—He
engaged Geissler (according to Hittorf) to make a glass tube in
which the platinum wire electrodes were sealed in the glass by
fusion, as in the modern incandescent lamp. After the air was
exhausted by a mechanical air pump through a capillary tube, the
same was sealed with the flame of a spirit lamp. He thus established
means whereby a practically permanent vacuum could be
maintained within a glass bulb. Platinum expands by heat at about
the same rate as glass: hence there is no tendency to crack and
admit air.

22. Geissler’s Experiment. Luminosity of Vacuum Tubes by Friction.


Increased by low temperature. Science Record, 1873.—By rubbing the
vacuum tubes with an insulator—cat skin, silk, etc.—he observed
that light was generated and that its color depended upon the
particular gas forming the residual atmosphere. At a low
temperature, the colors were more luminous. § 135. The best form
of tube consisted of a spiral tube contained within another tube. A
modified construction involved the introduction of mercury. By
exhausting the air, and shaking the tube, the friction or motion of
the mercury against the glass produced luminous effects according
to the gas. Only chemically pure mercury would cause the light,
which endured for an instant after the rubbing ceased. § 63.

23. Alvergniat’s Experiment. Luminosity of Vacuum Tubes by Friction and


Discharges. Different Vacua Required. Sci. Rec., 1873, p. 111. Comptes
Rendus, 1873.—To obtain luminosity by charging the tubes with the
coil, it was necessary to increase the degree of the vacuum—but
when this was done the rubbing of the tube would not cause light.
The tube employed was 45 cm. in length, and contained a small
quantity of silicic bromide. The atmospheric pressure within the tube
for obtaining the glimmer by friction was 15 mm.

24. Steinmetz’s Experiment. Luminous Effects by Alternating Current and


Solid Dielectrics. Trans. Amer. Inst. Elec. Eng., Feb. 21, ’93.—In
carrying on experiments in the accurate measurement of dielectric
strength, he noticed that upon placing mica between the electrodes,
as is hereinafter set forth, a spark did not at first form, but that
which he called a corona. He attributed the appearances to a
condenser phenomenon, or at least he suggested this as an
explanation. § 3. As soon as the corona reached the edge of the
plate, the disruptive discharge took place, by means of the sparks
passing over the edge of the dielectric. § 38. He employed an
alternating current dynamo of about 50 volts and 1 h.p., frequency
of 150 complete periods per second. The E. M. F. of the alternator was
varied, by changing the exciting current, up to 90 volts. Step-up
transformers were employed. With a difference of potential in the
secondary of 830 volts, and a thickness of mica of 1.8 mm. and
when the experiment was performed in a dark room a faint bluish
glow appeared between the mica and the electrodes. At 970 volts
the glow was brighter, while at 1560 volts the luminosity was visible
in broad day-light, and kept on increasing with the increase of E. M. F.
He modified the experiment by using mica of a thickness of 2.3
mcm. The difference of potential was 4.5 kilo-volts. In addition to
the bluish glow, violet streams or creepers broke out and increased
in number and length as the E. M. F. became greater, forming a kind
of aurora around the electrodes and on both sides of the mica sheet.
A loud hissing noise occurred. § 9. As soon as the corona reached
the edges of the mica, the disruptive discharge occurred in the form
of intensely white sparks and it was noticeable that the length of
these sparks was 10 fold greater than could be obtained in the air at
17 kilo-volts. These sparks were so hot as to oxidize the mica, as
apparent from the white marks remaining. The electrodes also
became very hot, and the mica was contorted and finally broke
down.

25. Morgan’s Experiment. No discharge in High Vacua. Wiedemann,


vol. 2. Phil. Trans., 1875, vol. 75.—He was led to believe by an
experiment, that when the vacuum is sufficiently perfect, no
electromotive force could drive the spark from one terminal to the
other, however close together they may be. § 18. Details of Morgan’s
Experiments were as follows, given roughly in his own words:—A
mercurial gauge about fifteen inches long, carefully and accurately
boiled till every particle of air was expelled from the inside, was
coated with tinfoil five inches down from its sealed end, and being
inverted into mercury through a perforation in the brass cap which
covered the mouth of the cistern, the whole was cemented together
and the air was exhausted from the inside of the cistern, through a
valve in the brass cap, which, producing a perfect vacuum in the
gauge, formed an instrument peculiarly well adapted for
experiments of this kind. Things being thus adjusted (a small wire
having been previously fixed on the inside of the cistern, to form a
communication between the brass cap and the mercury, into which
the gauge was inverted), the coated end was applied to the
conductor of an electrical machine, and notwithstanding every effort,
neither the smallest ray of light nor the slightest charge could ever
be procured in this exhausted gauge.
26. De La Rue and Müller’s Experiment. Constant Potential at the
Terminals of a Discharge Tube. Phil. Trans., part 1, vol. 169, p. 55 and
155.—The apparatus consisted of an exhausted bulb, a chloride
battery of 2400 cells and a large resistance adapted to be varied
between very wide limits. The result was a constant potential at the
electrodes of the bulb, during all the variations of the resistance.
They concluded, therefore, that the discharge in highly rarefied
gases is disruptive, the same as in air at ordinary pressure.

26a. Klingenberg’s Calculations. Direction of Discharge Tube Current in


Secondary of Ruhmkorff Coil. Translated from the German, by Ludwig
Gutmann. Extract of paper read by G. Klingenberg before the
Electro-technischer Verein. It would naturally be inferred that an
induction coil, the primary current of which is intermitted, and of one
direction, would produce an alternating current in the secondary coil.
The fact of the matter is, however, that a good induction coil will
produce the sparking only in but one direction. § 41. The reason is
the following: If the coil had no self-induction nor capacity, then the
current impulses would be represented by a rectangle a, Fig. 1. On
closing, the current would suddenly reach its maximum, which is
determined by the terminal pressure and circuit resistance, and this
current strength would be maintained as long as the circuit remained
closed. On the opening of the circuit, the current would decrease
just as suddenly; if not, the arc on opening of the circuit would
oppose such sudden fall, therefore the corner will be slightly
rounded at a, Fig. 2. The influence of self-induction, which we find in
any coil, is the force that will tend to oppose any change in the
current strength. Therefore, the self-induction will be the cause of a
retardation of the minimum current. On the other hand, it increases
the size of the spark on opening. Next a condenser is enclosed in the
main circuit, so that the spool is closed through it at the moment the
current is intercepted. If we assume, for simplicity sake, that the
magnetization of the iron is proportional to the current strength,
then the primary current curve represents at the same time, the
curve of the rate of change of line of force in the magnetic field. The
secondary E. M. F. is determined by e = n(dw/dt)t t; the rise then will
have a smaller E. M. F. than at the fall, like Fig. 3, except that the
curve representing the fall should be shown as more nearly
perpendicular to the abscissa.

27. Kinnersley, Harris and Riess’s


Experiments. Spark. Pressure Produced by.
Ganot, § 790, et al. Encyclo. Brit. Art. Elect.
—These experimenters passed a spark
through air contained over mercury, so that
if the pressure of the air were increased,
V
the mercury would move along through a
capillary tube, having a scale so that the
amount could be represented to the eye, as in the cut. (Fig. V.) The
experiments proved that when a spark passes through the air, the
pressure is increased, and it was concluded in view of several
experiments, that the spark being the source of an intense, but
small amount of heat, expanded the air, thereby causing the
pressure in a secondary manner, through the agency of heat. A
spark as short as 2 mm. will produce a considerable pressure of the
mercury. Riess performed an experiment also in causing the spark to
pass through cardboard, and also through mica located within the air
chamber. § 12. Other things being equal, the increase of
temperature was less by using the solid material like mica or cards,
than without. This illustrated that a part of the energy of the spark
was converted into heat and a part into mechanical force, and
explained why sound, § 24, is produced by a spark and by lightning.
CHAPTER II

28. Davy, Bancalari and Quet’s Experiments.


Electric Arc, Magnetism and Flame. Sound Produced.
Practical Application of Electric Arc. Phil. Mag.,
1801.—When the electric arc, for example
between two carbon electrodes, occurs, in a
powerful magnetic field, it is violently drawn to
one side as first shown by Sir Humphry Davy, as
if the wind were blowing it and sometimes it is
broken into two parts. Fig. VI. Again a loud noise
is produced. § 9. Without the magnet, the VI
appearance is as at the left. With the energized
magnet, the arc and light, as a whole, are as
shown at the right.

29. De La Rive’s Experiment. Rotation of Luminous Effect by Magnet.


Application to Explain Aurora Borealis. Phil Trans., vol. 137, 1847.
Pynchon, p. 471. Ganot, Sect. 928.—An oval discharge tube was
employed, having a highly exhausted atmosphere (for those days) of
spirits of turpentine. A cylindrically shaped pole of a magnet
extended into the bulb half way, Fig. 4, p. 17. The inner end of the
magnetic pole formed one electrode of the tube, and the other
electrode was a ring within the vacuum at the foot of the magnetic
pole. A fountain of light extended from one end of the magnet pole
to the other, and remained stationary, while the magnet was not
energized; but the light was condensed into an arc and travelled
around the magnet pole when a current was passed through the
coils of the magnet. For similar action of magnet on a flexible and
movable wire carrying a current, see experiments of Spottiswoode
and Stokes, Proc. R. So., 1875. The aurora borealis rotates around
the pole of the earth, and therefore, De La Rive thought that the
phenomenon in his laboratory and in nature were but one and the
same thing and different only in degree. He also extinguished an arc
in open air by means of a powerful magnet.

30. Plücker and Hittorf’s Experiments. Action of Magnet


on Cathode Column of Light. Pogg. Ann., 1858 and 1869.
Plücker found that the magnet acts on the cathode
light in a rarefied atmosphere in a different manner
from that on the anode light. In the former the light
VII
follows the magnetic curves and strike the side of the
bulb, according to position of the poles, see Fig. VII.
“Where the discharge is perpendicular to the line of the poles, it is
separated into two distinct parts, which can be referred to the
different action exerted by the electro-magnet on the two extra
currents produced in the discharge.” Ganot. § 925.

31. Thomson’s Experiment. A Discharge Retarded Across and Accelerated


Along the Lines of Magnetic Force. Nature, Lon., Jan. 31, 1895, p. 333.
Lect. Royal Inst.—Prof. J. J. Thomson, F. R. S., performed an
experiment which illustrates that the electrical discharge is retarded
in flowing across the lines of magnetic force and accelerated in
flowing with or parallel to such lines. As illustrated in Fig. 20, p. 17,
he employed a large electro-magnet adapted to be cut in and out of
circuit. He had two air chambers, one a bulb, indicated by a circle,
and the other a tube bent into a rectangle, indicated by the dotted
square. Between these, was an adjustable coil having its terminals
connected to the outside coatings of Leyden jars. When the
discharge took place between the poles of the magnet, that is, in the
direction of the lines of force, the discharge was helped along by the
magnetic field, but when it took place across the bulb, that is, across
the lines of force, the discharge was retarded. “The coil can be
adjusted so that when the magnet is ‘off’ the discharge passes
through the bulb, but not round the square tube; when, however,
the magnet is ‘on,’ the discharge passes in the square tube but not
in the bulb.”
Some Experiments prior to Lenard’s.

32. Thomson’s Experiment. Resistance Offered to Striae by a Thin


Diaphragm. Lect. Royal Inst. Nature, Lon. Jan. 31, ’95, p. 333.—It has
often been remarked that lightning always takes the easiest path.
The same has been noticed with references to the artificial electric
spark. Prof. J. J. Thomson, F.R.S. performed an experiment, which
not only confirms this principle but does so in an emphatic manner,
and proves it true in reference to the electric discharge in rarefied
gases. He arranged a very thin platinum diaphragm so as to divide a
Geissler tube into two compartments, Fig. 19, p. 17. He then formed
a passage way around the diaphragm, which could be opened and
closed by mercury, by respectively lowering and raising the lower
vessel of mercury along the barometer tube. When the passage way
is opened around the diaphragm, the luminosity extends through the
passage way in preference to going through the diaphragm. When
the passage way is closed by mercury, the discharge goes through
the thin metal plate. The same was found to occur when the
platinum leaf was replaced by a mica scale.

33. Sir David Solomon’s Experiment in 1894. Proc. Royal So., June 21,
’94. Nature, Lon. Sept. 13, ’94, p. 490.—With a tube having a
perforated diaphragm, he noticed a “forcing effect” at and near the
hole. The striae had the appearance of being pushed through from
the longer part of the tube—the diaphragm not being in the centre.
There was no passage way around the diaphragm—only through the
small puncture. § 19.
CHAPTER III

34. Riess’s Experiment. Electric Images. Riess’s Reibungs. vol. 2, §


739.—He laid a coin upon a plate of glass and charged the same
electrically about one-half of an hour or more. Upon removing the
coin and sprinkling the plate with dust, an engraving of the coin was
visible upon the glass. § 13. A suitable dust is licopodium powder.

35. Sanford and McKay’s Experiment. Electrographs. Original


Contribution by Prof. McKay of Packer Inst., Brooklyn, May, ’96.—The
picture of the coins in Fig. IX, was produced by the apparatus shown
in Fig. VIII, t, t, tinfoil, p, photographic plate with coins on sensitive
side, all wrapped in black paper. Fig. VIII represents the general
arrangement for taking electrographs. This particular one was made
by removing the upper tinfoil and touching each coin successively
with wire from one of the poles, while the other wire was connected
with tinfoil on the opposite side. The condenser thus formed is
charged and discharged many times by a Holtz machine or induction
coil. This is not a new discovery, it was first described by Prof.
Sanford, I think, of Leland Stanford University, two or three years
ago. Other claimants of earlier date probably exist.

36. Lichtenberg’s Experiment. Dust Figures. Pictures Drawn with Anode


and Cathode. Göttingen, 1778-79. Motum Fluidi Electriciti.—He drew
two independent superposed pictures upon a flat surface of an
insulating material, for example, rosin. One picture was drawn with
one terminal of a charged Leyden jar. Another picture was drawn
with the other terminal of a charged Leyden jar. He sprinkled upon
the surface over the two pictures, a dust made of a mixture of red
lead and sulphur powder. The former became attracted to the
picture drawn with the cathode, and the latter to that made with the
anode, so that the two figures were clearly visible. Before sprinkling
the powders upon the surface it is necessary to stir them together
whereby they become oppositely electrified.

VIII
Arrangements for Taking Electrographs. § 35, p. 19.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookball.com

You might also like