Dynamic System Modelling and Analysis with MATLAB and Python 1st Edition Jongrae Kim 2024 Scribd Download
Dynamic System Modelling and Analysis with MATLAB and Python 1st Edition Jongrae Kim 2024 Scribd Download
com
https://ebookmeta.com/product/dynamic-system-modelling-and-
analysis-with-matlab-and-python-1st-edition-jongrae-kim/
OR CLICK HERE
DOWLOAD NOW
https://ebookmeta.com/product/python-for-matlab-development-extend-
matlab-with-300000-modules-from-the-python-package-index-danial/
ebookmeta.com
https://ebookmeta.com/product/fiber-lasers-fundamentals-with-matlab-
modelling-1st-edition-johan-meyer-editor/
ebookmeta.com
https://ebookmeta.com/product/infinity-rpg-adventures-in-the-human-
sphere-1st-edition-justin-alexander/
ebookmeta.com
https://ebookmeta.com/product/hell-and-heaven-wayfinding-2-1st-
edition-hugh-howey/
ebookmeta.com
https://ebookmeta.com/product/bitty-fish-barbara-derubertis-eva-
vagreti-cockrille/
ebookmeta.com
https://ebookmeta.com/product/tras-el-llamado-1st-edition-javier-de-
la-vega-alfaro/
ebookmeta.com
Dynamic System Modelling and Analysis with MATLAB and Python
IEEE Press
445 Hoes Lane
Piscataway, NJ 08854
Jongrae Kim
University of Leeds
Leeds, UK
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any
form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise,
except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without
either the prior written permission of the Publisher, or authorization through payment of the
appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers,
MA 01923, (978) 750-8400, fax (978) 750-4470, or on the web at www.copyright.com. Requests to
the Publisher for permission should be addressed to the Permissions Department, John Wiley &
Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at
http://www.wiley.com/go/permission.
Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best
efforts in preparing this book, they make no representations or warranties with respect to the
accuracy or completeness of the contents of this book and specifically disclaim any implied
warranties of merchantability or fitness for a particular purpose. No warranty may be created or
extended by sales representatives or written sales materials. The advice and strategies contained
herein may not be suitable for your situation. You should consult with a professional where
appropriate. Further, readers should be aware that websites listed in this work may have
changed or disappeared between when this work was written and when it is read. Neither the
publisher nor author shall be liable for any loss of profit or any other commercial damages,
including but not limited to special, incidental, consequential, or other damages.
For general information on our other products and services or for technical support, please
contact our Customer Care Department within the United States at (800) 762-2974, outside the
United States at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in
print may not be available in electronic formats. For more information about Wiley products,
visit our web site at www.wiley.com.
Hardback: 9781119801627
Contents
Preface xiii
Acknowledgements xv
Acronyms xvii
About the Companion Website xix
1 Introduction 1
1.1 Scope of the Book 1
1.2 Motivation Examples 2
1.2.1 Free-Falling Object 2
1.2.1.1 First Program in Matlab 4
1.2.1.2 First Program in Python 10
1.2.2 Ligand–Receptor Interactions 14
1.3 Organization of the Book 21
Exercises 21
Bibliography 22
Index 307
xiii
Preface
This book is for control engineers to learn dynamic system modelling and sim-
ulation and control design and analysis using MATLAB or Python. The readers
are assumed to have the undergraduate final-year level of knowledge on ordinary
differential equations, vector calculus, probability, and basic programming.
We have verified all the MATLAB and Python codes in the book using MATLAB
R2021a and Python 3.8 in Spyder, the scientific Python development environment.
To reduce the confusion in running a particular program, most of the programs are
independent on their own. Organizing programming with multiple files is left as
an advanced skill for readers to learn after reading this book.
* * * * * *
In this way the book ran on for some three hundred pages. After I had
read it, I congratulated Scholasticus on his effort. “You have almost
succeeded,” I said, “in making Logic interesting; that is, if it is Logic. Now
that you have made such a good beginning, I wish you might go further.
You have taught us, by a natural method, how to reason fallaciously. I
wish you would now teach us how to reason correctly.”
“I wish I could,” said Scholasticus.
THE DIFFICULTIES OF THE PEACEMAKERS
* * * * * *
This is a free country, and the cynic must be allowed his fling. But if he
has license to speak his mind in regard to the simple-hearted people who
believe in Peace, we must be privileged to say what we think of him. The
truth is that we think him to be a rather shallow-pated fellow who has
been educated above his deserts. For all his knowing ways he has had
but little knowledge of the world. He has seen the things which are
obvious, the things that are shown to every outsider. He prides himself on
his familiarity with accomplished facts, not realizing that these belong to
the world that is passing away. The interesting things to see are those
which belong to the world that is in process of becoming. These are not
visible from the seat of the scornful.
The sweeping accusation of hypocrisy against men or nations whenever
an incongruity is perceived between a professed purpose and an actual
achievement is an indication of too great simplicity of mind. It is the
simplicity that is characteristic of one without experience in the work of
creation.
The cynic, perceiving the shortcomings of those who “profess and call
themselves Christians,” greets their professions with a bitter laugh. He
cannot tolerate their pretensions, and he urges them to return to a frank
profession of the paganism which their deeds proclaim. Now it is
eminently desirable that all who profess and call themselves Christians
should be Christians,—but that takes time. The profession is the first
step; that puts a whip into the hand of conscience. Not only do a man’s
friends, but particularly his enemies, insist that he shall live up to his
name. It is a wholesome discipline. In a new country two or three houses
set down in a howling wilderness are denominated a city. It is a mere
name at first, but if all goes well other metropolitan features are added in
due time. I remember a most interesting visit which I once made to a
university in a new commonwealth. The university consisted of a board of
regents, an unfenced bit of prairie for a “campus,” a president (who was
also professor of the Arts and Sciences), a janitor, and two unfinished
buildings. A number of the village children took courses which, if
persisted in for a number of years, might lead to what is usually termed
the Higher Education. One student from out of town dwelt in solitary
state in the dormitory. The president met me with great cordiality, and
after showing me “the plant” introduced me to the student. It was
evident that they were on terms of great intimacy, and that discipline in
the university was an easy matter, owing to the fact that the student body
was homogeneous.
Now it would be easy for one under such circumstances to laugh at what
seemed mere pretentiousness. “It was nothing more than a small school;
why not call it that and be done with it?” The reason for not doing so was
that it aimed at being a university. Its name was a declaration of purpose.
“Despise not the day of small things.” The small things may be very real
things; and then they have a trick of growing big before you know it.
In the world of creative activity the thought precedes the deed, the
profession comes before the achievement. The child makes believe that
he is a man, and his play is prophetic. Let us grant that multitudes who
profess and call themselves Christians are only playing at Christianity;
they have not yet begun to take the beatitudes seriously. It is a good
thing to play at, and the play is all the time deepening into earnest work.
When it becomes earnest, it is still far from perfect; but imperfection of
workmanship is no evidence of insincerity. He would be a poor critic who
at the spring exhibition should accuse the artist of attempt to deceive
because of his failure to achieve his professed purpose.
“Do you call that a picture of the Madonna? False-hearted hypocrite! Are
you wicked enough to attempt to poison our minds and prejudice us
against one who has been an object of worship? You are foisting upon us
an image of absolute imbecility.”
And yet the poor artist is no hypocrite,—he is only a poor artist, that is
all. He has striven to express what he has actually felt, and he has had
bad luck. He has been thrilled by an image of perfect womanhood, and
he sought to reproduce it for the joy of others. He wrought with sad
sincerity, and this is what came of it!
In the work of creating a condition of peace and good will among men
the Christian nations have not gone very far. But why twit on facts? Let us
be reasonable. Why should we take it as a grievance that our birth has
not been delayed till the Millennium, but that we have been placed
among those who are responsible for bringing it in? There is a satisfaction
in being allowed a part in the preliminary work. And what if many well-
meant endeavors have come to nought? Let us not spend our time crying
over the spilt milk of human kindness. It is natural that the first attempts
at peacemaking should be awkward. It takes time to get the knack of it.
It is foolish to reserve all our praise for perfection. That gives an
unpleasant impression, such as that which we receive from a person who,
when there is a call for small change, produces a bank bill of a large
denomination, which he knows no one can break for him.
“Peace on earth” is not a statement of accomplished fact, but a prophecy.
Now it is nothing against a prophecy that it has not yet been fulfilled. The
farther off it is, the more credit to the eyes that see and to the stout
hearts that patiently wait and work for it. The practical question is not
“Has it come?” but “Is it on the way?” We are considering a bit of the
unfinished business of the world.
First we must listen to the report of the progress already made. It is such
a modest report that we must prepare our minds in order to appreciate it.
The simple-minded cynic must be instructed in regard to the extreme
difficulty and complexity of the work that has been undertaken. It is
nothing less than the transformation of a carnivorous, not to say
cannibalistic, species into an orderly society in which each member shall
joyously and effectively work for the welfare of all. The first thing, of
course, is to catch your cannibals. This of itself is no easy task, and has
taken many centuries. It has involved a vast amount of wood-chopping
and road-making, and draining of swamps and exploring of caves and
dens. It is a task that is still far from accomplished. Savagery is a
condition which cannot be abolished till there is a conquest of the earth
itself. When the cannibals have been caught and tamed there comes the
problem of keeping them alive. They must eat something—a point which
many of the missionaries of civilization have not sufficiently considered.
Ethical progress is delayed by all sorts of economic complications. When
the natural man is confronted with the necessity of getting a living,
robbery is the first method which suggests itself to him. When this is
prohibited he turns upon his moral adviser with, “What more feasible way
do you propose?” The moral adviser has then to turn from the plain path
of pure ethics, and cudgel his poor wits trying to “invent a little something
ingenious” to keep his pupil from starving. The clever railer at human kind
who has always had a bank account to fall back upon has no idea how
much time and thought have been taken up in such contrivances.
Then it should be remembered that the missionaries of civilization have
not themselves been above reproach. The “multitudes of the heavenly
hosts” might be heard for a moment singing of good will among men, but
they did not remain to do the work. The men of good will who were to
work out the plan were very human indeed. Milton, in the Hymn “On the
Morning of Christ’s Nativity,” warns us of the long interval between the
Christmas prophecy and its historical fulfillment.
But all the imagery of the gala day of peace fades away before the
immediate reality.
This veto of “wisest Fate” is not absolute. It only calls a halt upon our
imagination until the rest of our nature catches up with it. Mankind is not
to have peace till it has suffered for it and worked for it. The workmen
must do their work over and over again till they have learned the right
way.
That the “Christian nations” are not hypocrites, but novices who have
been making some progress toward the Christian ideal, becomes evident
when we look back over their history. They are not the descendants of
the simple shepherds of the plains of Bethlehem. Far from it! When they
first began to “profess and call themselves Christians,” they were not
thinking of the beatitudes. They had not got that far.
Turn to the Heimskringla and read how King Olaf converted the pagan
bonders.
“So King Olaf went into the God-house and a certain few of his men with
him, and a certain few of the bonders. But when the king came whereas
the gods were, there sat Thor the most honored of all the gods, adorned
with gold and silver. Then King Olaf hove up the gold-wrought rod that he
had in his hand and smote Thor that he fell down from the stall; and
therewith ran forth all the king’s men and tumbled down all the gods from
their stalls. But whiles the king was in the God-house was Iron-Skeggi
slain without, even at the very door, and that deed did the king’s men. So
when the king was come back to his folk he bade the bonders take one of
two things, either all be christened, or else abide the brunt of battle with
him. But after the death of Skeggi there was no leader among the folk of
the bonders to raise up a banner against King Olaf. So the choice was
taken of them to go to the king and obey his bidding. Then King Olaf
christened all folk that were there and took hostages of the bonders that
they would hold to their christening. Thereafter King Olaf caused men of
his wend over all parts of Thrandheim; and now spoke no man against
the faith of Christ. And so were all folk christened in the country-side.”
That is the way the nations of the north were first christianized. What is
the difference between Thor and the Christ? the simple-hearted people
would ask. “The difference,” said King Olaf, “is very fundamental, and it
requires little theological training to see it. It is this: the Christ is stronger.
If you don’t believe it, I’ll”—but they did believe it.
It is evident that there were some points in Christianity that King Olaf did
not appreciate. To cultivate these fruits of the spirit required men of a
different temper. Their work is not all done yet. It is progressing.
* * * * * *
There is one complication in the work of peacemaking which has not been
sufficiently considered. It is the recurrence of Youth. I have listened to
the arguments against war at a great Peace Congress. The reasoning was
strong, the statement of facts conclusive. War was shown to be cruel and
foolish, and incredibly expensive. The audience, consisting of right-
minded and very intelligent people, was convinced of the justice of the
cause of Peace. Why, then, does not the cause triumph?
In such cases I am in the habit of looking about with the intent to fix the
responsibility where it belongs, on those who were not at the meeting.
Mature life was well represented, but there was a suspicious absence of
young men in the twenties. Ah! I said, there is the difficulty. We can’t be
sure of lasting peace until we make it more interesting to these young
absentees. They’ll all be peace men by and by, but meanwhile there is no
knowing what trouble they may get us into.
John Fiske traced the influence which the prolongation of infancy has had
on the progress of civilization. I am inclined to think that equally great
results would flow from any discovery by which the period of middle age
could be prolonged beyond its present term. War would be abolished
without any more ado. A uniformly middle-aged community would be
immune from any attack of militant fever.
It happens, however, that every once in a while the hot passions of youth
carry all before them. The account of what happened at the beginning of
the civil wars in Israel is typical. King Rehoboam called a meeting of the
elder statesmen of his kingdom. They outlined a policy that was
eminently conciliatory. But we are told, “He forsook the counsel of the old
men which they had given him, and consulted with the young men that
were grown up with him and which stood by him.”
That’s the difficulty! The hardest thing about a good policy is to get it
accepted by the people who have the power. What avails the wisdom of
the old men when all the young men are “spoiling for a fight?” Something
more is needed than statesman-like plans for strengthening the
framework of civilization. You may have a fireproof structure, but you are
not safe so long as it is crammed with highly inflammable material.
There is a periodicity in the passion for war. It marks the coming into
power of a new generation. A quarter of a century from now “the good
gray poet” Rudyard Kipling may be singing sweet lyrics of peace. All
things come in time. The Kipling we know simply utters the sentiments of
“the young men brought up with him.” What he has been to his
contemporaries Tennyson was to the generation before. Kipling never
wrote a more scornful arraignment of peace or a more passionate
glorification of war than Tennyson’s “Maud.”
We are listening to the invective of a youth whose aspirations have been
crushed and ideals shattered by a civilization that seems to him to be
soulless. He has seen something which to him is infinitely more cruel than
the battle between contending hosts
Why do they prate of the blessings of peace? we have made them a curse,
Pickpockets, each hand lusting for all that is not its own;
And lust of gain, in the spirit of Cain, is it better or worse
Than the heart of the citizen hissing in war on his own hearthstone?
We are made to see the inglorious peace in which men seek only their
own ease.
Peace sitting under her olive, and slurring the days gone by,
When the poor are hovell’d and hustled together, each sex, like swine,
When only the ledger lives, and when only not all men lie.
it lightened my despair
When I thought that a war would arise in defence of the right,
That an iron tyranny now should bend or cease,
The glory of manhood stand on his ancient height,
Nor Britain’s one sole God be the millionaire.
······························
Let it go or stay, so I wake to the higher aims
Of a land that has lost for a little her lust of gold,
And love of a peace that was full of wrongs and shames,
Horrible, hateful, monstrous, not to be told;
And hail once more to the banner of battle unroll’d!
That was an appeal to Young England, the England that was too young to
remember the Napoleonic wars and was thirsting for an experience of its
own.
We may see in such an outburst of the militant spirit only the
recrudescence of savagery. It is better to treat it seriously, for it is
something which each generation must reckon with. Tennyson sums up
the matter from the standpoint of ardent youth:—
Let it flame or fade, and the war roll down like a wind,
We have proved we have hearts in a cause, we are noble still,
And myself have awaked, as it seems, to the better mind.
It is better to fight for the good than to rail at the ill;
I have felt with my native land, I am one with my kind,
I embrace the purpose of God, and the doom assign’d.
The impatient human cry is followed by the refrain natural to those whose
lives are surrounded by the eternal calm of the desert,—
England and her Englishmen are forever inseparable. “This happy breed
of men” belong to “this little world, this precious stone set in a silver sea,
this blessed plot, this England.” That Great Britain is an island is more
than a fact of physical geography. It is the outward and visible sign of an
insularity of sentiment which gives its peculiar quality to British patriotism.
There is something snug and homelike about it, as of a family that enjoys
“the tumultuous privacy of storm.”
We become conscious of Spain and her Spaniards as we read Longfellow’s
lines:—
And beyond the mountains lies the American Avilion, where never—
* * * * * *
The conception of the continental proportions of America did not at once
dawn upon its new inhabitants. They thought and spoke as transplanted
Englishmen. Each of the thirteen States was a tight little republic insisting
on its own rights. Each plucky Diogenes sat in its own tub, saying to its
neighbors, “Get out of my sunshine!”
It was only as they turned westward that Americans discovered America,
—a discovery which in some instances has been long delayed. “The West”
is not merely a geographical expression, it is a state of mind which is
most distinctive of the national consciousness. It is a feeling, an
irresistible impulse. It is the sense of undeveloped resources and limitless
opportunities. It is associated with the verb “to go.” To the American the
West is the natural place to go to, as the East is the place to come from.
It is synonymous with freedom from restraint. It is always “out West.”
Just where the geographical West begins it is not necessary to indicate.
On the coast of Maine you may be shown a summer cottage and told that
it belongs to a rich Westerner from Massachusetts. Massachusetts is not
thought of as exactly the Far West, but it is far enough.
The psychological West begins at the point where the centre of interest
suddenly shifts from the day before yesterday to the day after to-morrow.
Great expectations are treated with the respect that elsewhere had been
reserved for accomplished facts. There is a stir in the air as if Humanity
were a new family just setting up housekeeping. What a fine house it is,
and how much room there is on the ground floor! What a great show it
will make when all the furniture is in! There is no time now for the
finishing touches, but all will come in due order. There is need for
unskilled labor and plenty of it. Let every able-bodied man lend a hand.
One does not know his America until he has been touched by the Western
fever. He must be possessed by a desire to take up a claim and build
himself a shack and invest in a corner lot in a Future Great City. He must
be capable of a disinterested joy in watching the improvements which
other people are making. Let the man of the East cling to the old ways
and seek out the old landmarks. The symbol of the West is the plank
sidewalk leading out from a brand-new prairie town and pointing to a
thriving suburb which as yet exists only in the mind of its projector. There
is something prophetic in that sidewalk on which the foot of man has
never trod.
One who has once had this fever never completely recovers. Though he
may change his environment he is always subject to intermittent attacks.
I remember on my first evening in Oxford sitting blissfully on the top of a
leisurely tram car that trundled along High Street. The dons in academic
garb were on their way to dinner in the college halls, and they looked just
as my imagination had pictured them. I was introduced to one of them.
When he learned that I was an American, there was a sudden thaw in his
manner.
“Have you ever been in Dodge City, Kansas?” he inquired eagerly.
I modestly replied that I had only passed through on the railway, but I
was familiar with other Kansas towns, and, reasoning from analogy, I
could tell what manner of place it was. This was enough. I had
experienced the West. I was one of the initiated. I could enter into that
state of mind represented by the term Dodge City. It appeared that in the
golden age, when he and Dodge City were both young, he had sought his
fortune for some months in Kansas. He had experienced the joys of civic
newness, a newness such as had not been in England since the
Heptarchy. He discoursed of the mighty men of those days when every
man did what was right in his own eyes, and good-humoredly allowed his
neighbor to do likewise. As we parted, he said, with mournful
acquiescence in his present estate, “Oxford does very well, you know, but
it isn’t Dodge City.” If poetry is emotion remembered in tranquillity, what
could be more poetical than Dodge City remembered in the tranquillity of
Oxford quadrangles?
In this case the poetical view was a sound one. The traveler across the
newly developed States of the West has the traveler’s license to contrast
unfavorably that which he sees with that which he left behind him in his
home country. He may say a dozen uncomplimentary things, and each
one of them may be true. He may exhaust all his stock adjectives, as
“crude” and “raw” and the like. But when he remarks, as did a certain
critic, that because the country lacks “distinction” it is uninteresting, he
betrays his own limitations.
It is just that lack of distinction that makes America interesting. Here, no
longer distracted by what is exceptional, one may take the welfare of the
masses of men seriously.
Here the doings of men correspond to the broad doings of the day and the night,
Here is what moves in magnificent masses, careless of particulars.
It was all a long time ago, and the men who did these things are not
clearly revealed. Not being able to get at their ideals, we attribute to
them those which we think appropriate.
The historians are troubled by their lack of authentic material. They are
like the magicians, astrologers, sorcerers, and Chaldeans of the court of
Nebuchadnezzar. Nebuchadnezzar had a dream that he knew was very
important, but before he could get it interpreted by his wise men he
forgot what it was. They were good at interpretations, and could have
made one to fit if only the king had brought the dream with him so that
they could try it on. But that was the very thing he could not do.
The founders of London and Paris had doubtless their dreams of the
future; but alas! they have long since been forgotten. But Chicago has
not had time to forget. Everything is still vivid. Men walk the streets of
the great city who remember it when it was no bigger than the Londinium
of the time of the Cæsars. They have with their own eyes watched every
step in the civic development and they have been a part of all that they
have seen. The Londoner has seen only a passing phase of his London;
the greater part of its history is received on hearsay evidence. The
Chicagoan sees his Chicago steadily and sees it whole. No wonder that
there is a self-consciousness about the new metropolis that is not to be
found in the old. Its greatness has been thrust upon it suddenly, and
there is a full realization of its value.
The genuine American who is the maker of the new fortunes of the world,
and who is in love with his work, has not been adequately portrayed in
literature. It requires an ample imagination to do justice to his character.
There must be a mingling of realism and romance. The realism must not
be the minute, painstaking portraiture of a Miss Austen, but the hearty,
out-of-door reality of a Fielding. The American Fielding has not yet
appeared, but what a good time he will have when he comes! What a
host of characters after his own heart he will find! The American Scott,
too, is called for to give us a story of American life which will read as well
on the edge of a clearing in the forest as “The Lady of the Lake” did in
the trenches of Torres Vedras, when the soldiers forgot the enemy’s shells
as they gave a glorious shout over the poet’s lines, which their captain
was reading to them. I like that story, in spite of the fact that a recent
critic declares that to like it shows an uncultivated taste. “This is not,” he
says, “a test of poetry. An audience less likely to be critical, a situation
less likely to induce criticism, can hardly be imagined.” Nevertheless, Scott
would much rather have written lines that rang true to soldiers in the
hour of battle, than to have been given a high mark by the most
competent corrector of daily themes.
The imagination of Hawthorne, brooding over the past, repeopled the
House of the Seven Gables with the successive generations. But there is
another kind of romance, in which the imagination is projected into the
future. Looking at the new house not yet enclosed against the storm, it