Professional Documents
Culture Documents
Preface
Audience
This book can be used by students, professional engineers, and technicians.
The first part of the book can be used as a primer to MATLAB. It will be
useful to all students and professionals who want a basic introduction to
MATLAB. Parts 2 and 3 are for electrical engineering students and electrical
engineers who want to use MATLAB to explore the characteristics of semi-
conductor devices and the application of MATLAB for analysis and design
of electrical and electronic circuits and systems.
Organization
The book is divided into three parts: Introduction to MATLAB, circuit anal-
ysis applications using MATLAB, and electronics applications with
MATLAB. It is recommended that the reader work through and experiment
with the examples at a computer while reading Chapters 1, 2, and 3. The
hands-on approach is one of the best ways of learning MATLAB.
1892_book.fm Page viii Friday, May 7, 2004 8:37 AM
Acknowledgments
Contents
2 Plotting Functions......................................................................... 25
2.1 Graph Functions ..........................................................................................25
2.2 X-Y Plots and Annotations.........................................................................25
2.3 Logarithmic and Polar Plots ......................................................................30
2.4 Subplots and Screen Control .....................................................................33
2.5 Other Plotting Functions ............................................................................35
2.5.1 Bar Plots............................................................................................35
2.5.2 Hist Function ...................................................................................36
2.5.3 Stem Plots .........................................................................................36
Bibliography ..........................................................................................................38
Problems.................................................................................................................39
4 DC Analysis................................................................................... 63
4.1 Nodal Analysis.............................................................................................63
4.2 Loop Analysis...............................................................................................68
4.3 Maximum Power Transfer .........................................................................77
4.3.1 MATLAB Diff and Find Functions...............................................79
1892_book.fm Page xvi Friday, May 7, 2004 8:37 AM
Bibliography ..........................................................................................................82
Problems.................................................................................................................82
1
MATLAB Fundamentals
1
1892_C01.fm Page 2 Wednesday, May 12, 2004 11:23 AM
È1 2 3ù
Í ú
A = Í2 3 4ú
ÍÎ3 4 5úû
may be entered as follows:
A = [1 2 3; 2 3 4; 3 4 5];
Note that the matrix entries must be surrounded by brackets [ ], with row
elements separated by blanks or by commas. The end of each row, with the
exception of the last row, is indicated by a semicolon. A matrix A can also
be entered across three input lines as
A = [ 1 2 3
2 3 4
3 4 5];
In this case, the carriage returns replace the semicolons. A row vector B
with four elements,
B = [ 6 9 12 15 18 ]
can be entered in MATLAB as
B = [6 9 12 15 18];
or
B = [6, 9, 12, 15, 18]
For readability, it is better to use spaces rather than commas between the
elements. The row vector B can be turned into a column vector by transpo-
sition, which is obtained by typing
1892_C01.fm Page 3 Wednesday, May 12, 2004 11:23 AM
MATLAB Fundamentals 3
C = B’
The above results in
C =
6
9
12
15
18
Other ways of entering the column vector C are
C = [6
9
12
15
18]
or
C = [6; 9; 12; 15; 18]
MATLAB is case sensitive in naming variables, commands, and functions.
Thus b and B are not the same variable. If you do not want MATLAB to be
case sensitive, you can use the command
casesen off
To obtain the size of a specific variable, type size ( ). For example, to find
the size of matrix A, you can execute the following command:
size(A)
The result will be a row vector with two entries. The first is the number
of rows in A, the second the number of columns in A.
Table 1.1 shows additional MATLAB commands to get one started on
MATLAB. Detailed descriptions and usages of the commands can be
obtained from the MATLAB help facility or from MATLAB manuals.
TABLE 1.1
Some Basic MATLAB Commands
Command Description
% Comments; everything appearing after the % command is not executed
demo Access on-line demo programs
length Length of a matrix
clear Clears the variables or functions from workspace
clc Clears the command window during a work session
clg Clears graphic window
diary Saves a session in a disk, possibly for printing at a later date
MATLAB Fundamentals 5
b
a
where inv is the MATLAB function for obtaining the inverse of a matrix.
The right division denoted by V/Z is equivalent to the MATLAB expression
I = V * inv ( Z )
1892_C01.fm Page 6 Wednesday, May 12, 2004 11:23 AM
TABLE 1.2
Some Common MATLAB Functions
Function Description
abs(x) Calculates the absolute value of x
acos(x) Determines cos–1x, with the results in radians
asin(x) Determines sin–1x, with the results in radians
atan(x) Calculates tan–1x, with the results in radians
Ê yˆ
atan2(x) Obtains tan–1 Á ˜ over all four quadrants of the circle; the results are in radians
Ë x¯
cos(x) Calculates cos(x), with x in radians
exp(x) Computes ex
log(x) Determines the natural logarithm loge (x)
sin(x) Calculates sin(x), with x in radians
TABLE 1.3
Some Utility Matrices
Function Description
diag(A) Produces a vector consisting of the diagonal of a square matrix A
eye(n) Generates an n-by-n identity matrix
eye(n,m) Generates an n-by-m identity matrix
ones(n) Produces an n-by-m matrix with all the elements being unity
ones(n,m) Produces an n-by-m matrix with all the elements being unity
zeros(n) Generates an n-by-n matrix of zeros
zeros(n,m) Generates an n-by-m matrix of zeros
In addition to the function inv, there are some other common MATLAB
functions worth noting. These functions can be found in Table 1.2.
There are MATLAB functions that can be used to produce special matrices
and also to initialize variables. Examples are given in Table 1.3.
È 10ù È 3 6 9 ù È I1 ù
Í ú Í úÍ ú
Í 15ú = Í 6 15 12ú Í I2 ú
ÍÎ 12úû ÍÎ 9 12 20úû ÍÎ I3 úû
Solution
We use the inv command to solve for the current.
Another random document with
no related content on Scribd:
the regulation of the pendulum is performed by adding to, or
diminishing the mercury, in the part where the tube is widest.”
In addition to the foregoing description of the mechanism of this Time-piece,
obligingly furnished to the Writer of these Memoirs by Mr. Voight, he has been
likewise favoured by Robert Patterson, Esq. director of the mint, with the
following account of the same extremely accurate instrument, which will
greatly assist the reader in understanding the principles on which it is
constructed.
“Now, when the heat of the air encreases, it will expand the
pendulum-rod; and would thus lower the centre of oscillation, and
cause the clock to go slower: but this effect is completely
counteracted, by the expansion of the alcohol chiefly, and of the
mercury in part; which equally raises the centre of oscillation; and
thus preserves an equable motion in all the variable temperatures of
the atmosphere.”
Description of an Hygrometer; first contrived and used by Dr.
Rittenhouse, about the year 1782.[A45]
Nov. 2d, 1776. I got ready the two f. reflector with the largest
object-glass, and shortest eye-tube, magnifying about 95 times.
At 4h 5′ per clock—took my eye from the tube to adjust it, and fix
the smoked glass, to give clearer vision, the atmosphere being hazy.
Having fixed the smoked glass in the proper place, so as to prevent
its sliding or falling with its own weight, and before I had applied my
eye to the telescope again, Mr. Rittenhouse came in; and I desired
him to see if the focus and dark glass were all suitable to his eye, as
they were to mine. I had been about 4′ employed in this adjustment.
Equal Altitudes.
dh ′ ″ h ′ \″
Nov. 39 14 9 2 37 12 ☉ on Merid. per clock h ′ ″
15 44 2 35 35 or mean noon 11 55 40
Equat. Correspond. Alt. + 14.4
Correct Noon per Clock 11 55
54.4
49 32 48 20 56 Mean Noon, or ☉ on 11 56 53
34 33 19 13 Merid. per. Clock
36 14 17 31 Equat. of equal + 13.8
37 20 16 23 Altitudes
14 39
40 54 2 12 53 Correct Noon per Clock 11 57 6.8
78 51 9 9 29 Mean 12 0 19
Noon
52 37 80 per Equat Eq. Alt. + 12
Clock
54 1 3 6 37 12 0 19
Cor. 12 0 31
Noon
per Clock
Per Meridian Mark.
d h ′ ″
8 ☉ West Limb on Merid. 12 0 36
East Limb on do. 12 2 52
—-——
Centre 12 1 44
Correct Noon per Clock.
4th,
Clock slower than ☉ 2 53.2 ′ ″
☉ faster than mean time 16 9 From 3d to 4th 1 10.4
Clock faster than m. time 13 15.8
7th,
Clock faster than ☉ 0 31
From 4th mean to
☉ faster than mean time 16 00 7 that a mean 1 5.1
Clock faster than m. time 16 31 per day
8th,
Clock faster than ☉ 1 44
☉ faster than mean time 15 56 From 7th to 8th 1 9
Clock faster than m. time 17 40
Thus the Clock gains at a
mean, per day, 1′ 8″.
Whence, Nov. 2d, at noon, the Clock was 10′ 57″ faster than mean
time, gaining 68″ per day; and 4h 17′ gains 12″, wherefore at the
internal contact, the Clock was 11′ 9″ faster than mean time.
The same was visible, in about 3″ more, to Mr. Lukens, with the
equal altitude instrument, magnifying about 25 times.
Mr. Rittenhouse had not got the other reflector ready to observe
the beginning of the eclipse: but the end was observed by both of us
to the same instant, viz. at 11h 48′ 50″ per clock.
The clock, at noon, was 23″ slower than mean time, whence
N.B. The clock stopped once during the Observation, owing, it was
supposed, to the cold weather; but was oiled a little, and set a going
again by a stop-watch that beats seconds, and which was set with
the clock at the beginning of the eclipse: so that she lost no time.
She was examined at noon, and found as above by the meridian
mark. But this mark itself, having been lately shaken with the stormy
weather, is to be re-examined, and also equal altitudes taken the
following days.
Micrometer Measures.
h ′ ″ inches. tenths. 500ths.
9 15 0 2 2 6
distances of the cusps.
31 0 3 1 ½
10 17 5 1 1 14 enlightened parts
22 0 1 1 23 remaining.
11 37 0 1 7 6
38 46 1 5 21 distances of the cusps.
42 26 1 2 18
Whence clock faster than mean time 0 1′ 46″ per merid. mark.
Equal Altitudes.
h ′ ″
20th. 9 37 20 59 49
39 1 58 6 Mean noon per clock 12 18 34
40 41 2 56 26
21st. W. limb on Merid. 12 20 3
E. limb on do. 22 22
Centre on do. 12 21 12.5
Eq. Alt.
22d. 9 14 10 3 31 10 Mean noon per clock 12 23 50
The morning being very cloudy, the beginning of the eclipse was
not seen.
11h 6′ 57″ per clock end of eclipse distinctly seen, the Sun having
shone clearly for several minutes, the clouds now wholly dispersing,
and the remainder of the day continuing clear.
First Zephyr.
Second Zephyr.
First Zephyr.
Second Zephyr.
First Zephyr.
Diploma.
Diploma.
Letter from the Rev. Mr. Cathcart, to the Writer of these Memoirs.
Dear Sir,
Robert Cathcart.
Dear Sir,
Andrew Ellicott.
In the years 1784 and 1785, Dr. Rittenhouse and myself were
engaged in determining the boundaries between this commonwealth
and the state of Virginia; and in the year 1786, in determining the
boundary between this commonwealth and the state of New-York. In
those arduous employments, I had many opportunities of witnessing
his address in overcoming the numerous difficulties we necessarily
had to encounter, in the then wilderness, in which our operations
were performed.
“In the year 1777,” says his Lordship, “my learned friend John
Bernouilli, of Berlin, on one of his tours having happened to meet
with the Bishop of Warmia,[A53] in the Abbey of Oliva, near Dantzic,
was informed by that prelate, that he had the pleasure to discover, in
the Cathedral of Frauenburg, the Tomb of Copernicus, so long
fruitlessly sought for.
“In the year 1778, Mr. Bernouilli having occasion to pass through
Frauenburg, on his road to St. Petersburg, did not fail to visit the
Cathedral, and explore the Monument of Copernicus. Acquainted
with no one in the place, he was yet lucky enough to meet with a
Canon, in the street, whose countenance invited him to accost him
on this subject, and who proved very attentive to his researches. He
informed him, that as for the Ashes of Copernicus, they were
mingled in the charnel-house with the bones of the fraternity of the
Canons; but that, for the Tombstone of the Philosopher, it was no
more than a tablet of marble, simple, as the mode was of his days,
and had no other inscription than these words—Nic. Copernicus,
Thor:—-That this tablet had remained hidden for some time, in
rubbish; and when recovered, was placed in the chapter-house, till a
more suitable place should be destined for it. Mr. Bernouilli
expresses his regret to me, that he had not urged the Canon to
indulge him with a sight of this Stone; and to look for a further
inscription, to support the assertion of Gassendi, who mentions
(page 325), That the Bishop Martin Cromer, an eminent Polish
historian, caused a mural marble monument to be inscribed and
erected to the memory of Copernicus, with the following inscription:
D. O. M.
R. D. NICOLAO COPERNICO,
Torunensi, Artium et
Medicinæ Doctori,
Canonico Warmiensi,
Præsenti Astrologo, et
Ejus Disciplinæ
Instauratori;
Martinus Cromerus,
Episcopus Warmiensis,
Honoris, et ad Posteritatem
Memoriæ, Causâ, posuit;
M. D. L. X. X. X. I.
“Gassendi adds, that this Monument was not erected until thirty-six
years after the death of Copernicus, which does not agree with this
date of 1581.
“In the above mentioned book, p. 1442, there is a neat little Print of
Copernicus. In Hartknoch’s Alter und newes Preusen, here is a print
of Copernicus, from a picture on wood which hangs in what they call
his Cenotaph, at Thorn; and which represents him kneeling, in his
canonicals, before a Crucifix;—and below this portrait are these
sapphic verses:
(a little lower)
“Upon the whole,” concludes Lord Buchan, “it appears the likeness
I send, of Copernicus, is most to be depended on; and, as such, I
flatter myself it will be an Heir-loom to infant America! Concerning
Napier, it is needless for me to enlarge; the learned Dr. Minto having
enabled me to do justice to his memory.”