SlideShare a Scribd company logo
Contents
Part I Introduction to Programming for Engineers
1 MATLAB Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2 Variables and Basic Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4 Branching Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5 Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
7 Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
8 Representation of Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
9 Errors, Good Programming Practices, and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
10 Reading and Writing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
11 Visualization and Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Part II Introduction to Numerical Methods
12 Linear Algebra and Systems of Linear Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
13 Least Squares Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
14 Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
15 Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Edition Siauw Solutions Manual
Full Download: https://alibabadownload.com/product/introduction-to-matlab-programming-and-numerical-methods-for-engineers-
This sample only, Download all chapters at: AlibabaDownload.com
4 Contents
16 Root Finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
17 Numerical Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
18 Numerical Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
19 Ordinary Differential Equations (ODEs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Part I
Introduction to Programming for Engineers
1
MATLAB Basics
1. Remove the command history window from the MATLAB environment and then retrieve it.
To remove it, click the ”x” in the upper left hand corner of the command history window. To retrieve
it, go to Desktop → Command History.
2. Resize the command prompt so that it takes up less than half of the total MATLAB environment
space.
Click and drag the borders of the Command Prompt to achieve this effect.
3. Change the background of the MATLAB environment to black and the font color to orange.
Go to File → Preferences → Colors (PC) or Matlab → Preferences → Colors (MAC), and change
the colors as needed.
4. Change the current directory to any folder other than the current default working directory, and then
change it back to the default directory.
Change the folder above the Command Prompt.
5. Type >> travel into the command prompt. This program tries to solve the Traveling Salesman
Problem.
>> travel
6. Type >> filterguitar into the command prompt. This program simulates the sound of a guitar
using mathematical and computational methods.
>> filterguitar
8 1 MATLAB Basics
7. Type >> lorenz into the command prompt. The Lorenz Attractor is a mathematical model originally
formulated to simulate atmospheric weather patterns. However, it has some surprising results that eventually
led to the field of Chaos Theory. This program displays the simulation results for different initial conditions.
>> lorenz
8. Compute the area of a triangle with base 10 and height 12. Recall that the area of a triangle is half
the base times the height.
>> 0.5*10*12
9. Compute the surface area and volume of a cylinder with radius 5 and height 3.
>> 2*pi*5ˆ2 + 2*pi*5*3
10. Compute the slope between the points (3, 4) and (5, 9). Recall that the slope between points (x1, y1)
and (x2, y2) is y2−y1
x2−x1
.
>> (9−4)/(5−3)
11. Compute the distance between the points (3, 4) and (5, 9). Recall that the distance between points
in two dimensions is (x2 − x1)2 + (y2 − y1)2.
>> sqrt((9−4)ˆ2 + (5−3)ˆ2)
12. Use MATLAB’s factorial function to compute 6!.
>> factorial(6)
13. A year is considered to be 365 days long. However, a more exact figure is 365.24 days. As a consequence,
if we held to the standard 365-day year, we would gradually lose that fraction of the day over time, and
seasons and other astronomical events would not occur as expected. A leap year is a year that has an extra
day, February 29, to keep the timescale on track. Leap years occur on years that are exactly divisible by 4,
1 MATLAB Basics 9
unless it is exactly divisible by 100, unless it is divisible by 400. For example, the year 2004 is a leap year,
the year 1900 is not a leap year, and the year 2000 is a leap year.
Compute the number of leap years between the years 1500 and 2010.
WARNING: This is not necessarily the best solution.
>> ((2000 − 1500)/4 + 1 + 2) − ((2000 − 1500)/100 + 1) + ((2000−1600)/400+1)
14. A very powerful approximation for π was developed by a brilliant mathematician named Srinivasa
Ramanujan. The approximation is the following:
1
π
≈
2
√
2
9801
N
k=0
(4k)!(1103 + 26390k)
(k!)43964k
.
Use Ramanujan’s formula for N = 0 and N = 1 to approximate π. Be sure to use format long. Compare
your approximation with MATLAB’s stored value for pi. Hint: 0! = 1 by definition.
>> format long
>> (2*sqrt(2)*1103/9801)ˆ−1
>> ((2*sqrt(2)/9801)*(1103 + factorial(4)*(1103 + 26390)/(396ˆ4)))ˆ−1
15. The hyperbolic sin or sinh is defined in terms of exponentials as sinh(x) = exp(x)−exp(−x)
2 .
Compute sinh for x = 2 using exponentials. Verify that the result is indeed the hyperbolic sin using MAT-
LAB’s built-in function sinh.
>> 0.5*(exp(2) − exp(−2))
>> sinh(2)
16. Verify that sin2
(x) + cos2
(x) = 1 for x = π, π
2 , π
4 , π
6 . Use format long.
>> format long
>> sin(pi)ˆ2 + cos(pi)ˆ2
>> sin(pi/2)ˆ2 + cos(pi/2)ˆ2
>> sin(pi/4)ˆ2 + cos(pi/4)ˆ2
>> sin(pi/6)ˆ2 + cos(pi/6)ˆ2
17. Call the help function for the function sind. Use sind to compute the sin 87◦
.
10 1 MATLAB Basics
>> help sind
>> sind(87)
18. Write a MATLAB statement that generates the following error:
“Undefined function or method ‘sni’ for input arguments of type ‘double’.”
Hint: sni is a misspelling of the function sin.
>> sni(pi)
19. Write a MATLAB statement that generates the following error:
“Not enough input arguments.”
Hint: Input arguments refers to the input of a function (any function), e.g., the input in sin(pi/2) is
pi/2.
>> sin()
20. Write a MATLAB statement that generates the following error:
“Expression or statement is incorrect–possibly unbalanced (, {, or [.”
>> (3 + 5
21. If P is a logical expression, the law of non-contradiction states that P AND (NOT P) is always false.
Verify this for P true and P false.
TRUE AND NOT(TRUE) = TRUE AND FALSE = FALSE.
FALSE AND NOT(FALSE) = FALSE AND TRUE = FALSE.
22. Let P and Q be logical expressions. De Morgan’s rule states that NOT (P OR Q) = (NOT P) AND
(NOT Q) and NOT (P AND Q) = (NOT P) OR (NOT Q). Generate the truth tables for each statement
to show that De Morgan’s rule is always true.
For the first row and first column indicating P and Q true, respectively, and the second row and second
column indicating P and Q false, respectively, the truth tables for each side of De Morgan’s rule will be
the following:
1 MATLAB Basics 11
0 0
0 1
.
23. Under what conditions for P and Q is (P AND Q) OR (P AND (NOT Q)) false?
Whenever P is false.
24. Construct an equivalent logical expression for OR using only AND and NOT.
NOT((NOT P) AND (NOT Q))
25. Construct an equivalent logical expression for AND using only OR and NOT.
NOT ( (NOT P) OR (NOT Q))
26. The logical operator XOR has the following truth table:
P
Q
01
1
1
0
0 0
1
Fig. 1.1. XOR Truth Table.
Construct an equivalent logical expression for XOR using only AND, OR, and NOT that has the same truth
table.
(P AND (NOT Q)) OR ((NOT P) AND Q)
27. Do the following calculation at the MATLAB command prompt. Give answers accurate to 16 digits.
e2
sin π/6 + loge(3) cos π/9 − 53
12 1 MATLAB Basics
>> format long
>> exp(2)*sin(pi/6) + log(3)*cos(pi/9) − 5ˆ3
28. Do the following logical and comparison operations at the MATLAB command prompt. You may
assume that P and Q are logical expressions.
For P = 1 and Q = 1: Compute NOT(P) AND NOT(Q).
For a = 10 and b = 25: Compute (a < b) AND (a == b).
>> ∼1 & ∼1
>> (10 < 25) & (10 == 25)
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Edition Siauw Solutions Manual
Full Download: https://alibabadownload.com/product/introduction-to-matlab-programming-and-numerical-methods-for-engineers-
This sample only, Download all chapters at: AlibabaDownload.com

More Related Content

Similar to Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Edition Siauw Solutions Manual

Scilabisnotnaive
ScilabisnotnaiveScilabisnotnaive
Scilabisnotnaive
zan
 
Scilab is not naive
Scilab is not naiveScilab is not naive
Scilab is not naive
Scilab
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
phuong pheakdey
 
Reading Materials for Operational Research
Reading Materials for Operational Research Reading Materials for Operational Research
Reading Materials for Operational Research
Derbew Tesfa
 
Applied finite mathematics 5..pdf
Applied finite mathematics 5..pdfApplied finite mathematics 5..pdf
Applied finite mathematics 5..pdf
Lori Head
 
Elements of Programming Interviews.pdf
Elements of Programming Interviews.pdfElements of Programming Interviews.pdf
Elements of Programming Interviews.pdf
Sudhir Biswal
 
Vic broquard c++ for computer science and engineering 2006
Vic broquard c++ for computer science and engineering 2006Vic broquard c++ for computer science and engineering 2006
Vic broquard c++ for computer science and engineering 2006Souvik Maity
 
Getstart graphic
Getstart graphicGetstart graphic
Getstart graphic
alldesign
 
Algorithmic Mathematics.
Algorithmic Mathematics.Algorithmic Mathematics.
Algorithmic Mathematics.
Dr. Volkan OBAN
 
An Introduction to MATLAB for Geoscientists.pdf
An Introduction to MATLAB for Geoscientists.pdfAn Introduction to MATLAB for Geoscientists.pdf
An Introduction to MATLAB for Geoscientists.pdf
vishnuraj764102
 
Systems interfacesanddeployment
Systems interfacesanddeploymentSystems interfacesanddeployment
Systems interfacesanddeploymentXavier Davias
 
3016 all-2007-dist
3016 all-2007-dist3016 all-2007-dist
3016 all-2007-distNYversity
 
book for vector analysis
book for vector analysis book for vector analysis
book for vector analysis
FrancisPrince Salazar
 
Librodecalculo3 130926170959-phpapp01
Librodecalculo3 130926170959-phpapp01Librodecalculo3 130926170959-phpapp01
Librodecalculo3 130926170959-phpapp01PaReJaiiZz
 
Vector
VectorVector
Vector
Yassin Balja
 
Vector calculus corral
Vector calculus corralVector calculus corral
Vector calculus corralduvasxel
 
Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...
Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...
Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...
Gollapalli Sreenivasulu
 
Rapport d'analyse Dimensionality Reduction
Rapport d'analyse Dimensionality ReductionRapport d'analyse Dimensionality Reduction
Rapport d'analyse Dimensionality Reduction
Matthieu Cisel
 

Similar to Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Edition Siauw Solutions Manual (20)

Scilabisnotnaive
ScilabisnotnaiveScilabisnotnaive
Scilabisnotnaive
 
Scilab is not naive
Scilab is not naiveScilab is not naive
Scilab is not naive
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
 
Reading Materials for Operational Research
Reading Materials for Operational Research Reading Materials for Operational Research
Reading Materials for Operational Research
 
Applied finite mathematics 5..pdf
Applied finite mathematics 5..pdfApplied finite mathematics 5..pdf
Applied finite mathematics 5..pdf
 
Elements of Programming Interviews.pdf
Elements of Programming Interviews.pdfElements of Programming Interviews.pdf
Elements of Programming Interviews.pdf
 
Vic broquard c++ for computer science and engineering 2006
Vic broquard c++ for computer science and engineering 2006Vic broquard c++ for computer science and engineering 2006
Vic broquard c++ for computer science and engineering 2006
 
Getstart graphic
Getstart graphicGetstart graphic
Getstart graphic
 
Algorithmic Mathematics.
Algorithmic Mathematics.Algorithmic Mathematics.
Algorithmic Mathematics.
 
An Introduction to MATLAB for Geoscientists.pdf
An Introduction to MATLAB for Geoscientists.pdfAn Introduction to MATLAB for Geoscientists.pdf
An Introduction to MATLAB for Geoscientists.pdf
 
Systems interfacesanddeployment
Systems interfacesanddeploymentSystems interfacesanddeployment
Systems interfacesanddeployment
 
3016 all-2007-dist
3016 all-2007-dist3016 all-2007-dist
3016 all-2007-dist
 
book for vector analysis
book for vector analysis book for vector analysis
book for vector analysis
 
Librodecalculo3 130926170959-phpapp01
Librodecalculo3 130926170959-phpapp01Librodecalculo3 130926170959-phpapp01
Librodecalculo3 130926170959-phpapp01
 
Vector
VectorVector
Vector
 
Libro de calculo 3
Libro de calculo 3Libro de calculo 3
Libro de calculo 3
 
Vector Calculus
 Vector Calculus Vector Calculus
Vector Calculus
 
Vector calculus corral
Vector calculus corralVector calculus corral
Vector calculus corral
 
Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...
Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...
Addison Wesley - Modern Control Systems Analysis and Design Using Matlab, Bis...
 
Rapport d'analyse Dimensionality Reduction
Rapport d'analyse Dimensionality ReductionRapport d'analyse Dimensionality Reduction
Rapport d'analyse Dimensionality Reduction
 

Recently uploaded

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
Mohammed Sikander
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 

Recently uploaded (20)

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Multithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race conditionMultithreading_in_C++ - std::thread, race condition
Multithreading_in_C++ - std::thread, race condition
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 

Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Edition Siauw Solutions Manual

  • 1. Contents Part I Introduction to Programming for Engineers 1 MATLAB Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 Variables and Basic Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4 Branching Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5 Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 6 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 7 Complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 8 Representation of Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 9 Errors, Good Programming Practices, and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 10 Reading and Writing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 11 Visualization and Plotting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Part II Introduction to Numerical Methods 12 Linear Algebra and Systems of Linear Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 13 Least Squares Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 14 Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 15 Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Edition Siauw Solutions Manual Full Download: https://alibabadownload.com/product/introduction-to-matlab-programming-and-numerical-methods-for-engineers- This sample only, Download all chapters at: AlibabaDownload.com
  • 2. 4 Contents 16 Root Finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 17 Numerical Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 18 Numerical Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 19 Ordinary Differential Equations (ODEs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
  • 3. Part I Introduction to Programming for Engineers
  • 4.
  • 5. 1 MATLAB Basics 1. Remove the command history window from the MATLAB environment and then retrieve it. To remove it, click the ”x” in the upper left hand corner of the command history window. To retrieve it, go to Desktop → Command History. 2. Resize the command prompt so that it takes up less than half of the total MATLAB environment space. Click and drag the borders of the Command Prompt to achieve this effect. 3. Change the background of the MATLAB environment to black and the font color to orange. Go to File → Preferences → Colors (PC) or Matlab → Preferences → Colors (MAC), and change the colors as needed. 4. Change the current directory to any folder other than the current default working directory, and then change it back to the default directory. Change the folder above the Command Prompt. 5. Type >> travel into the command prompt. This program tries to solve the Traveling Salesman Problem. >> travel 6. Type >> filterguitar into the command prompt. This program simulates the sound of a guitar using mathematical and computational methods. >> filterguitar
  • 6. 8 1 MATLAB Basics 7. Type >> lorenz into the command prompt. The Lorenz Attractor is a mathematical model originally formulated to simulate atmospheric weather patterns. However, it has some surprising results that eventually led to the field of Chaos Theory. This program displays the simulation results for different initial conditions. >> lorenz 8. Compute the area of a triangle with base 10 and height 12. Recall that the area of a triangle is half the base times the height. >> 0.5*10*12 9. Compute the surface area and volume of a cylinder with radius 5 and height 3. >> 2*pi*5ˆ2 + 2*pi*5*3 10. Compute the slope between the points (3, 4) and (5, 9). Recall that the slope between points (x1, y1) and (x2, y2) is y2−y1 x2−x1 . >> (9−4)/(5−3) 11. Compute the distance between the points (3, 4) and (5, 9). Recall that the distance between points in two dimensions is (x2 − x1)2 + (y2 − y1)2. >> sqrt((9−4)ˆ2 + (5−3)ˆ2) 12. Use MATLAB’s factorial function to compute 6!. >> factorial(6) 13. A year is considered to be 365 days long. However, a more exact figure is 365.24 days. As a consequence, if we held to the standard 365-day year, we would gradually lose that fraction of the day over time, and seasons and other astronomical events would not occur as expected. A leap year is a year that has an extra day, February 29, to keep the timescale on track. Leap years occur on years that are exactly divisible by 4,
  • 7. 1 MATLAB Basics 9 unless it is exactly divisible by 100, unless it is divisible by 400. For example, the year 2004 is a leap year, the year 1900 is not a leap year, and the year 2000 is a leap year. Compute the number of leap years between the years 1500 and 2010. WARNING: This is not necessarily the best solution. >> ((2000 − 1500)/4 + 1 + 2) − ((2000 − 1500)/100 + 1) + ((2000−1600)/400+1) 14. A very powerful approximation for π was developed by a brilliant mathematician named Srinivasa Ramanujan. The approximation is the following: 1 π ≈ 2 √ 2 9801 N k=0 (4k)!(1103 + 26390k) (k!)43964k . Use Ramanujan’s formula for N = 0 and N = 1 to approximate π. Be sure to use format long. Compare your approximation with MATLAB’s stored value for pi. Hint: 0! = 1 by definition. >> format long >> (2*sqrt(2)*1103/9801)ˆ−1 >> ((2*sqrt(2)/9801)*(1103 + factorial(4)*(1103 + 26390)/(396ˆ4)))ˆ−1 15. The hyperbolic sin or sinh is defined in terms of exponentials as sinh(x) = exp(x)−exp(−x) 2 . Compute sinh for x = 2 using exponentials. Verify that the result is indeed the hyperbolic sin using MAT- LAB’s built-in function sinh. >> 0.5*(exp(2) − exp(−2)) >> sinh(2) 16. Verify that sin2 (x) + cos2 (x) = 1 for x = π, π 2 , π 4 , π 6 . Use format long. >> format long >> sin(pi)ˆ2 + cos(pi)ˆ2 >> sin(pi/2)ˆ2 + cos(pi/2)ˆ2 >> sin(pi/4)ˆ2 + cos(pi/4)ˆ2 >> sin(pi/6)ˆ2 + cos(pi/6)ˆ2 17. Call the help function for the function sind. Use sind to compute the sin 87◦ .
  • 8. 10 1 MATLAB Basics >> help sind >> sind(87) 18. Write a MATLAB statement that generates the following error: “Undefined function or method ‘sni’ for input arguments of type ‘double’.” Hint: sni is a misspelling of the function sin. >> sni(pi) 19. Write a MATLAB statement that generates the following error: “Not enough input arguments.” Hint: Input arguments refers to the input of a function (any function), e.g., the input in sin(pi/2) is pi/2. >> sin() 20. Write a MATLAB statement that generates the following error: “Expression or statement is incorrect–possibly unbalanced (, {, or [.” >> (3 + 5 21. If P is a logical expression, the law of non-contradiction states that P AND (NOT P) is always false. Verify this for P true and P false. TRUE AND NOT(TRUE) = TRUE AND FALSE = FALSE. FALSE AND NOT(FALSE) = FALSE AND TRUE = FALSE. 22. Let P and Q be logical expressions. De Morgan’s rule states that NOT (P OR Q) = (NOT P) AND (NOT Q) and NOT (P AND Q) = (NOT P) OR (NOT Q). Generate the truth tables for each statement to show that De Morgan’s rule is always true. For the first row and first column indicating P and Q true, respectively, and the second row and second column indicating P and Q false, respectively, the truth tables for each side of De Morgan’s rule will be the following:
  • 9. 1 MATLAB Basics 11 0 0 0 1 . 23. Under what conditions for P and Q is (P AND Q) OR (P AND (NOT Q)) false? Whenever P is false. 24. Construct an equivalent logical expression for OR using only AND and NOT. NOT((NOT P) AND (NOT Q)) 25. Construct an equivalent logical expression for AND using only OR and NOT. NOT ( (NOT P) OR (NOT Q)) 26. The logical operator XOR has the following truth table: P Q 01 1 1 0 0 0 1 Fig. 1.1. XOR Truth Table. Construct an equivalent logical expression for XOR using only AND, OR, and NOT that has the same truth table. (P AND (NOT Q)) OR ((NOT P) AND Q) 27. Do the following calculation at the MATLAB command prompt. Give answers accurate to 16 digits. e2 sin π/6 + loge(3) cos π/9 − 53
  • 10. 12 1 MATLAB Basics >> format long >> exp(2)*sin(pi/6) + log(3)*cos(pi/9) − 5ˆ3 28. Do the following logical and comparison operations at the MATLAB command prompt. You may assume that P and Q are logical expressions. For P = 1 and Q = 1: Compute NOT(P) AND NOT(Q). For a = 10 and b = 25: Compute (a < b) AND (a == b). >> ∼1 & ∼1 >> (10 < 25) & (10 == 25) Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Edition Siauw Solutions Manual Full Download: https://alibabadownload.com/product/introduction-to-matlab-programming-and-numerical-methods-for-engineers- This sample only, Download all chapters at: AlibabaDownload.com