SlideShare a Scribd company logo
Dynamics and Control
For Any Quarries or info, Contact us on :- +1 678 648 4277
You can Mail us on :- info@matlabassignmentexperts.com
Visit us on :- https://www.matlabassignmentexperts.com/
Matlab Assignment Help
Problem 1 : Calculating the factorial of non-negative integer with recursion
Write a function to calculate the factorial of non-negative integer, n! as in the last homework.
However, for this time, you should use a recursive algorithm. Function name (and m-file name)
should be ‘fctrlrc_your_kerberos_name’ and upload it to 2.003 MIT Server site. You also
submit hardcopy of your code. Calculate 125! with this function.
Solution:
Calculating the factorial of non-negative integer with recursion
n! is associated with (n −1)! as below:
n! = nx(n-1)x….x2x1=nx(n-1)!
Therefore, the function of calculating n! is achieved by calling itself for (n-1)! and multiplying n
. m-file is shown as below:
Matlab Assignment Help
The output of 125! will be displayed as below.
Matlab Assignment Help
Problem 2 : Developing the Algorithm for the Solution of the Tower of Hanoi
The tower of Hanoi (commonly also known as the "towers of Hanoi"), is a mathematical
game or puzzle invented by E. Lucas in 1883. It is also very famous example for using
recursion in programming. It consists of three posts, and N different size disks. Initially, N
disks are stacked on the leftmost side post (starting post or post 1) in the order of the largest
one on the bottom to the smallest one on the top. Your task is to move all the disks on the
rightmost side post (end post or post 3) with same order of disks. You can use the middle
post (intermediate post or post 2) for temporary stacking of disks.
During the movement of disks, you must further follow these rules:
1. Only one disk is allowed to be moved at a time.
2. In each move, only the disk on the top of any post can move and be
stacked on another post.
3. The bigger disk must always be stacked below the smaller ones.
Matlab Assignment Help
i) Obtain the solution for the tower of Hanoi with N=2 different size disks. Don’t try to use
MATLAB at this time. Just write down the order of disk movements as below:
‘Trial number’ : from ‘post number’ to ‘post number’
ii) Express your algorithm for the solution of the tower of Hanoi with N different size disks. You
can assume that you have the algorithm for solving the N-1 disk problem. You can then develop
an algorithm for the N-disk problem using the N-1 disk solution based on recursive.
Solution:
Developing the Algorithm for the Solution of the Tower of Hanoi
i) Now, you have 2 different size disks, the small and the big one, in the tower of Hanoi.
First, top disk (the small one) on the starting post can be moved to either intermediate
post or ending post. Since ending post should be reserved for the big disk, the small one
is moved to intermediate post (from 1 to 2). Next, remaining disk (the big one) on the
staring post should be stacked on the ending post since there is no disk on this post.
(from 1 to 3). Finally, the disk placed on the intermediate post is also stacked on the
ending post.
1: from 1 to 2
2: from 1 to 3
3: from 2 to 3
Matlab Assignment Help
ii) Assume that you have N different size disks for the tower of Hanoi. They are located on
the starting post. Now, we define function MoveTower(N,sp,ep,ip) to move whole N disks
from the starting post (sp) to ending post (ep) with using intermediate disk (ip). This function
can be rewritten with MoveTower associated with (N-1) disks movement.
To move whole disks from one to another, at least the biggest disk should move from sp to
ep. To achieve this task, (N-1) disks on top of the biggest should move from spto ip at first.
After moving the biggest disk, (N-1) disk on the intermediate post (ip) should be stacked to
the ending post (ep). This procedure for recursive algorithm is also described in below
figures.
In addition to general case, special case N=0 should be considered. Since
MoveTower(0,sp,ep,ip) means that there is no disk to move, nothing will be done.
Therefore, following description is for the recursive algorithm for the solution of the
tower of Hanoi with N different size disks
Matlab Assignment Help
1. If N is smaller than 1, just return (in the special case of MoveTower(0,sp,ep,ip))
2. Output Å MoveTower(N-1,sp,ip,ep) (move N-1 disks from sp to ip)
3. Output Å [sp ep] (move the biggest disk from sp to ep)
4. Output Å MoveTower(N-1,ip,ep,sp) (move N-1 disks from ip to ep)
Matlab Assignment Help
Problem 3 : Solving the Tower of Hanoi with recursive algorithm
Now, generate the function or m-file for the solution of “tower of Hanoi” with 5 different size
disks. Use recursive approach. Your function has input argument of ‘n’, number of disk on the
starting post, and output argument of ‘o’, matrix for disk movements (each row represents each
movement from the post indicated in the first column to the post shown in the second column.
For example, [1 3] means movement from post 1 to post 3) Function name (and m-file name)
should be ‘hanoi_your_kerberos_name’ and upload it to 2.003 MIT Server site. You submit
hardcopy of your function code as well as the solution of the tower of Hanoi with 5 different size
disks. Execution of m-file should provide the following result in case of N=1:
Solution:
By using your own algorithm, the function to solve the tower of Hanoi is shown as below.
Please, see the comments for each line.
Matlab Assignment Help
Matlab Assignment Help
Matlab Assignment Help
The solution of the tower of Hanoi with 5 different size disks is represented as below:
Matlab Assignment Help
Problem 4 : (Optional) Comparison between solving problem with and without
recursion.
In problem 5.1., you are asked to make the function of calculating n! with different algorithms.
These functions basically work same in terms of mathematics, but they don’t in terms of
computer performance. Describe both advantage and disadvantage of each approach briefly.
Solution:
Two m-code works same in terms of the output of calculating the factorials. However, they are
not quite different in the view of computer and programming performance. First, the program
with the recursive algorithm is very concise, and easy to understand. Recursive algorithm
requires so many function calls, and it needs stack memories to keep current position of
program counter and some variables for each function call. In addition, function call needs
much more . CPU time than normal operations. Eventually, running the code with recursion
gives the value too late where large number of recursion is necessary. In case of
programming without recursion, program itself can be a little complicated, but it runs faster
than recursive version. However, it is sometimes much more useful to solve the problem
recursively than sequentially like the tower of Hanoi.
Matlab Assignment Help

More Related Content

What's hot

Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
Matlab Assignment Experts
 
Signals Processing Homework Help
Signals Processing Homework HelpSignals Processing Homework Help
Signals Processing Homework Help
Matlab Assignment Experts
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
Naveed Rehman
 
Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
Matlab Assignment Experts
 
Programming Assignment Help
Programming Assignment HelpProgramming Assignment Help
Programming Assignment Help
Programming Homework Help
 
Intro to Matlab programming
Intro to Matlab programmingIntro to Matlab programming
Intro to Matlab programming
Ahmed Moawad
 
Ch10 Recursion
Ch10 RecursionCh10 Recursion
Ch10 Recursion
leminhvuong
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
Abdullah Al-hazmy
 
Recursion - Algorithms and Data Structures
Recursion - Algorithms and Data StructuresRecursion - Algorithms and Data Structures
Recursion - Algorithms and Data Structures
Priyanka Rana
 
Module 01 Stack and Recursion
Module 01 Stack and RecursionModule 01 Stack and Recursion
Module 01 Stack and Recursion
Tushar B Kute
 
multi threaded and distributed algorithms
multi threaded and distributed algorithms multi threaded and distributed algorithms
multi threaded and distributed algorithms
Dr Shashikant Athawale
 
Recursion
RecursionRecursion
Recursion
Malainine Zaid
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
Infinity Tech Solutions
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 
Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programming
VisnuDharsini
 
DSP System Homework Help
DSP System Homework HelpDSP System Homework Help
DSP System Homework Help
Matlab Assignment Experts
 
Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2
bilawalali74
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and design
Megha V
 
Solution 3.
Solution 3.Solution 3.
Solution 3.
sansaristic
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)
Thai Pangsakulyanont
 

What's hot (20)

Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
 
Signals Processing Homework Help
Signals Processing Homework HelpSignals Processing Homework Help
Signals Processing Homework Help
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
 
Programming Assignment Help
Programming Assignment HelpProgramming Assignment Help
Programming Assignment Help
 
Intro to Matlab programming
Intro to Matlab programmingIntro to Matlab programming
Intro to Matlab programming
 
Ch10 Recursion
Ch10 RecursionCh10 Recursion
Ch10 Recursion
 
Data Structures- Part5 recursion
Data Structures- Part5 recursionData Structures- Part5 recursion
Data Structures- Part5 recursion
 
Recursion - Algorithms and Data Structures
Recursion - Algorithms and Data StructuresRecursion - Algorithms and Data Structures
Recursion - Algorithms and Data Structures
 
Module 01 Stack and Recursion
Module 01 Stack and RecursionModule 01 Stack and Recursion
Module 01 Stack and Recursion
 
multi threaded and distributed algorithms
multi threaded and distributed algorithms multi threaded and distributed algorithms
multi threaded and distributed algorithms
 
Recursion
RecursionRecursion
Recursion
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
Functions in advanced programming
Functions in advanced programmingFunctions in advanced programming
Functions in advanced programming
 
DSP System Homework Help
DSP System Homework HelpDSP System Homework Help
DSP System Homework Help
 
Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and design
 
Solution 3.
Solution 3.Solution 3.
Solution 3.
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)
 

Similar to Control System Homework Help

Network Design Assignment Help
Network Design Assignment HelpNetwork Design Assignment Help
Network Design Assignment Help
Computer Network Assignment Help
 
Sure interview algorithm-1103
Sure interview algorithm-1103Sure interview algorithm-1103
Sure interview algorithm-1103
Sure Interview
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
Dr. Rupa Ch
 
dynamic programming Rod cutting class
dynamic programming Rod cutting classdynamic programming Rod cutting class
dynamic programming Rod cutting class
giridaroori
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
aboma2hawi
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 
Control system Lab record
Control system Lab record Control system Lab record
Control system Lab record
Yuvraj Singh
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
Krishnan MuthuManickam
 
Control System Assignment Help
Control System Assignment HelpControl System Assignment Help
Control System Assignment Help
Matlab Assignment Experts
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Jay Nagar
 
algorithm unit 1
algorithm unit 1algorithm unit 1
algorithm unit 1
Monika Choudhery
 
Report_NLNN
Report_NLNNReport_NLNN
Report_NLNN
Rishi Metawala
 
Introductory manual for the open source potential solver: NEMOH
Introductory manual for the open source potential solver: NEMOHIntroductory manual for the open source potential solver: NEMOH
Introductory manual for the open source potential solver: NEMOH
Filippos Kalofotias
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdf
pasinduneshan
 
Recursion in Data Structure
Recursion in Data StructureRecursion in Data Structure
Recursion in Data Structure
khudabux1998
 
Analysing simple pendulum using matlab
Analysing simple pendulum using matlabAnalysing simple pendulum using matlab
Analysing simple pendulum using matlab
Akshay Mistri
 
Introduction to OpenMP
Introduction to OpenMPIntroduction to OpenMP
Introduction to OpenMP
Akhila Prabhakaran
 
Loop parallelization & pipelining
Loop parallelization & pipeliningLoop parallelization & pipelining
Loop parallelization & pipelining
jagrat123
 
6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx
Venkateswara Babu Ravipati
 
lecture 23
lecture 23lecture 23
lecture 23
sajinsc
 

Similar to Control System Homework Help (20)

Network Design Assignment Help
Network Design Assignment HelpNetwork Design Assignment Help
Network Design Assignment Help
 
Sure interview algorithm-1103
Sure interview algorithm-1103Sure interview algorithm-1103
Sure interview algorithm-1103
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
 
dynamic programming Rod cutting class
dynamic programming Rod cutting classdynamic programming Rod cutting class
dynamic programming Rod cutting class
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
 
Control system Lab record
Control system Lab record Control system Lab record
Control system Lab record
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
 
Control System Assignment Help
Control System Assignment HelpControl System Assignment Help
Control System Assignment Help
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
algorithm unit 1
algorithm unit 1algorithm unit 1
algorithm unit 1
 
Report_NLNN
Report_NLNNReport_NLNN
Report_NLNN
 
Introductory manual for the open source potential solver: NEMOH
Introductory manual for the open source potential solver: NEMOHIntroductory manual for the open source potential solver: NEMOH
Introductory manual for the open source potential solver: NEMOH
 
complexity analysis.pdf
complexity analysis.pdfcomplexity analysis.pdf
complexity analysis.pdf
 
Recursion in Data Structure
Recursion in Data StructureRecursion in Data Structure
Recursion in Data Structure
 
Analysing simple pendulum using matlab
Analysing simple pendulum using matlabAnalysing simple pendulum using matlab
Analysing simple pendulum using matlab
 
Introduction to OpenMP
Introduction to OpenMPIntroduction to OpenMP
Introduction to OpenMP
 
Loop parallelization & pipelining
Loop parallelization & pipeliningLoop parallelization & pipelining
Loop parallelization & pipelining
 
6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx6-Python-Recursion PPT.pptx
6-Python-Recursion PPT.pptx
 
lecture 23
lecture 23lecture 23
lecture 23
 

More from Matlab Assignment Experts

🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
Matlab Assignment Experts
 
MAtlab Assignment Help
MAtlab Assignment HelpMAtlab Assignment Help
MAtlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
Matlab Assignment Experts
 
Matlab Homework Help
Matlab Homework HelpMatlab Homework Help
Matlab Homework Help
Matlab Assignment Experts
 
MATLAB Assignment Help
MATLAB Assignment HelpMATLAB Assignment Help
MATLAB Assignment Help
Matlab Assignment Experts
 
Matlab Homework Help
Matlab Homework HelpMatlab Homework Help
Matlab Homework Help
Matlab Assignment Experts
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
Matlab Assignment Experts
 
Computer vision (Matlab)
Computer vision (Matlab)Computer vision (Matlab)
Computer vision (Matlab)
Matlab Assignment Experts
 
Online Matlab Assignment Help
Online Matlab Assignment HelpOnline Matlab Assignment Help
Online Matlab Assignment Help
Matlab Assignment Experts
 
Modelling & Simulation Assignment Help
Modelling & Simulation Assignment HelpModelling & Simulation Assignment Help
Modelling & Simulation Assignment Help
Matlab Assignment Experts
 
Mechanical Assignment Help
Mechanical Assignment HelpMechanical Assignment Help
Mechanical Assignment Help
Matlab Assignment Experts
 
CURVE FITING ASSIGNMENT HELP
CURVE FITING ASSIGNMENT HELPCURVE FITING ASSIGNMENT HELP
CURVE FITING ASSIGNMENT HELP
Matlab Assignment Experts
 
Design and Manufacturing Homework Help
Design and Manufacturing Homework HelpDesign and Manufacturing Homework Help
Design and Manufacturing Homework Help
Matlab Assignment Experts
 
Digital Image Processing Assignment Help
Digital Image Processing Assignment HelpDigital Image Processing Assignment Help
Digital Image Processing Assignment Help
Matlab Assignment Experts
 
Signals and Systems Assignment Help
Signals and Systems Assignment HelpSignals and Systems Assignment Help
Signals and Systems Assignment Help
Matlab Assignment Experts
 
Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
Matlab Assignment Experts
 

More from Matlab Assignment Experts (20)

🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
🚀 Need Expert MATLAB Assignment Help? Look No Further! 📊
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
MAtlab Assignment Help
MAtlab Assignment HelpMAtlab Assignment Help
MAtlab Assignment Help
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
Matlab Homework Help
Matlab Homework HelpMatlab Homework Help
Matlab Homework Help
 
MATLAB Assignment Help
MATLAB Assignment HelpMATLAB Assignment Help
MATLAB Assignment Help
 
Matlab Homework Help
Matlab Homework HelpMatlab Homework Help
Matlab Homework Help
 
Matlab Assignment Help
Matlab Assignment HelpMatlab Assignment Help
Matlab Assignment Help
 
Computer vision (Matlab)
Computer vision (Matlab)Computer vision (Matlab)
Computer vision (Matlab)
 
Online Matlab Assignment Help
Online Matlab Assignment HelpOnline Matlab Assignment Help
Online Matlab Assignment Help
 
Modelling & Simulation Assignment Help
Modelling & Simulation Assignment HelpModelling & Simulation Assignment Help
Modelling & Simulation Assignment Help
 
Mechanical Assignment Help
Mechanical Assignment HelpMechanical Assignment Help
Mechanical Assignment Help
 
CURVE FITING ASSIGNMENT HELP
CURVE FITING ASSIGNMENT HELPCURVE FITING ASSIGNMENT HELP
CURVE FITING ASSIGNMENT HELP
 
Design and Manufacturing Homework Help
Design and Manufacturing Homework HelpDesign and Manufacturing Homework Help
Design and Manufacturing Homework Help
 
Digital Image Processing Assignment Help
Digital Image Processing Assignment HelpDigital Image Processing Assignment Help
Digital Image Processing Assignment Help
 
Signals and Systems Assignment Help
Signals and Systems Assignment HelpSignals and Systems Assignment Help
Signals and Systems Assignment Help
 
Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
 

Recently uploaded

คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 

Recently uploaded (20)

คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 

Control System Homework Help

  • 1. Dynamics and Control For Any Quarries or info, Contact us on :- +1 678 648 4277 You can Mail us on :- info@matlabassignmentexperts.com Visit us on :- https://www.matlabassignmentexperts.com/ Matlab Assignment Help
  • 2. Problem 1 : Calculating the factorial of non-negative integer with recursion Write a function to calculate the factorial of non-negative integer, n! as in the last homework. However, for this time, you should use a recursive algorithm. Function name (and m-file name) should be ‘fctrlrc_your_kerberos_name’ and upload it to 2.003 MIT Server site. You also submit hardcopy of your code. Calculate 125! with this function. Solution: Calculating the factorial of non-negative integer with recursion n! is associated with (n −1)! as below: n! = nx(n-1)x….x2x1=nx(n-1)! Therefore, the function of calculating n! is achieved by calling itself for (n-1)! and multiplying n . m-file is shown as below: Matlab Assignment Help
  • 3. The output of 125! will be displayed as below. Matlab Assignment Help
  • 4. Problem 2 : Developing the Algorithm for the Solution of the Tower of Hanoi The tower of Hanoi (commonly also known as the "towers of Hanoi"), is a mathematical game or puzzle invented by E. Lucas in 1883. It is also very famous example for using recursion in programming. It consists of three posts, and N different size disks. Initially, N disks are stacked on the leftmost side post (starting post or post 1) in the order of the largest one on the bottom to the smallest one on the top. Your task is to move all the disks on the rightmost side post (end post or post 3) with same order of disks. You can use the middle post (intermediate post or post 2) for temporary stacking of disks. During the movement of disks, you must further follow these rules: 1. Only one disk is allowed to be moved at a time. 2. In each move, only the disk on the top of any post can move and be stacked on another post. 3. The bigger disk must always be stacked below the smaller ones. Matlab Assignment Help
  • 5. i) Obtain the solution for the tower of Hanoi with N=2 different size disks. Don’t try to use MATLAB at this time. Just write down the order of disk movements as below: ‘Trial number’ : from ‘post number’ to ‘post number’ ii) Express your algorithm for the solution of the tower of Hanoi with N different size disks. You can assume that you have the algorithm for solving the N-1 disk problem. You can then develop an algorithm for the N-disk problem using the N-1 disk solution based on recursive. Solution: Developing the Algorithm for the Solution of the Tower of Hanoi i) Now, you have 2 different size disks, the small and the big one, in the tower of Hanoi. First, top disk (the small one) on the starting post can be moved to either intermediate post or ending post. Since ending post should be reserved for the big disk, the small one is moved to intermediate post (from 1 to 2). Next, remaining disk (the big one) on the staring post should be stacked on the ending post since there is no disk on this post. (from 1 to 3). Finally, the disk placed on the intermediate post is also stacked on the ending post. 1: from 1 to 2 2: from 1 to 3 3: from 2 to 3 Matlab Assignment Help
  • 6. ii) Assume that you have N different size disks for the tower of Hanoi. They are located on the starting post. Now, we define function MoveTower(N,sp,ep,ip) to move whole N disks from the starting post (sp) to ending post (ep) with using intermediate disk (ip). This function can be rewritten with MoveTower associated with (N-1) disks movement. To move whole disks from one to another, at least the biggest disk should move from sp to ep. To achieve this task, (N-1) disks on top of the biggest should move from spto ip at first. After moving the biggest disk, (N-1) disk on the intermediate post (ip) should be stacked to the ending post (ep). This procedure for recursive algorithm is also described in below figures. In addition to general case, special case N=0 should be considered. Since MoveTower(0,sp,ep,ip) means that there is no disk to move, nothing will be done. Therefore, following description is for the recursive algorithm for the solution of the tower of Hanoi with N different size disks Matlab Assignment Help
  • 7. 1. If N is smaller than 1, just return (in the special case of MoveTower(0,sp,ep,ip)) 2. Output Å MoveTower(N-1,sp,ip,ep) (move N-1 disks from sp to ip) 3. Output Å [sp ep] (move the biggest disk from sp to ep) 4. Output Å MoveTower(N-1,ip,ep,sp) (move N-1 disks from ip to ep) Matlab Assignment Help
  • 8. Problem 3 : Solving the Tower of Hanoi with recursive algorithm Now, generate the function or m-file for the solution of “tower of Hanoi” with 5 different size disks. Use recursive approach. Your function has input argument of ‘n’, number of disk on the starting post, and output argument of ‘o’, matrix for disk movements (each row represents each movement from the post indicated in the first column to the post shown in the second column. For example, [1 3] means movement from post 1 to post 3) Function name (and m-file name) should be ‘hanoi_your_kerberos_name’ and upload it to 2.003 MIT Server site. You submit hardcopy of your function code as well as the solution of the tower of Hanoi with 5 different size disks. Execution of m-file should provide the following result in case of N=1: Solution: By using your own algorithm, the function to solve the tower of Hanoi is shown as below. Please, see the comments for each line. Matlab Assignment Help
  • 11. The solution of the tower of Hanoi with 5 different size disks is represented as below: Matlab Assignment Help
  • 12. Problem 4 : (Optional) Comparison between solving problem with and without recursion. In problem 5.1., you are asked to make the function of calculating n! with different algorithms. These functions basically work same in terms of mathematics, but they don’t in terms of computer performance. Describe both advantage and disadvantage of each approach briefly. Solution: Two m-code works same in terms of the output of calculating the factorials. However, they are not quite different in the view of computer and programming performance. First, the program with the recursive algorithm is very concise, and easy to understand. Recursive algorithm requires so many function calls, and it needs stack memories to keep current position of program counter and some variables for each function call. In addition, function call needs much more . CPU time than normal operations. Eventually, running the code with recursion gives the value too late where large number of recursion is necessary. In case of programming without recursion, program itself can be a little complicated, but it runs faster than recursive version. However, it is sometimes much more useful to solve the problem recursively than sequentially like the tower of Hanoi. Matlab Assignment Help