Engineering Problem Solving With Matlab and Maple: April 2019

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/332496946

ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

Book · April 2019

CITATIONS READS
0 9,797

1 author:

Mahesh Chandra Luintel


Institute of Engineering, Tribhuvan University, Nepal
48 PUBLICATIONS   41 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Dynamic Analysis of Pelton Turbine and Assembly View project

Transmission Loss Minimization View project

All content following this page was uploaded by Mahesh Chandra Luintel on 18 April 2019.

The user has requested enhancement of the downloaded file.


ENGINEERING PROBLEM SOLVING
WITH MATLAB AND MAPLE

Exercise Sheets

Mahesh Chandra Luintel


Table of Contents
EXERCISE 1 .................................................................................................................................................... 3

EXERCISE 2 .................................................................................................................................................... 5

EXERCISE 3 .................................................................................................................................................... 7

EXERCISE 4 .................................................................................................................................................... 9

EXERCISE 5 .................................................................................................................................................. 12

EXERCISE 6 .................................................................................................................................................. 14

EXERCISE 7 .................................................................................................................................................. 16

EXERCISE 8 .................................................................................................................................................. 17

EXERCISE 9 .................................................................................................................................................. 19

EXERCISE 10 ................................................................................................................................................ 21

EXERCISE 11 ................................................................................................................................................ 23

2
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 1
BASIC MATHEMATICS I

Solve the following problems in the MATLAB Command Window.

1. Calculate
35.7.64 − 73 5 2
37
(a) (b) . 7. 6 + 3
45 + 52 4 (9 − 652)
2732/3 552 2732
(c) (2 + 7)3 + + (d) 23 + 73 + + 553⁄2
2 3 2
2
37 log(76) 3 4
� √250 + 23�
(e) + √910 (f) 43.
73 + 546 3)
𝑒 (45−3
π 𝜋𝑙𝑛8
5𝜋 2 7𝜋 𝑡𝑎𝑛 � 6 �
(g) 2
5𝜋 7𝜋 2 tan �6 ln8� (h) 2
𝑐𝑜𝑠 � � 𝑠𝑖𝑛 � � +
𝑐𝑜𝑠 � � 𝑠𝑖𝑛 � � + 6 8 5
6 8 √7 7. 2
2. Define the variable x as x = 13.5, then evaluate
√14𝑥 3
(a) 𝑥 3 + 5𝑥 2 − 26.7𝑥 − 52 (b) (c) 𝑙𝑜𝑔|𝑥 2 − 𝑥 3 |
𝑒 3𝑥

3. Define the variable a, b, c and d as as a = 15.62, b = - 7.08, c = 62.5 and d = 0.5(ab - c), then
evaluate
𝑎𝑑 + 𝑏𝑐
𝑎𝑏 (𝑎 + 𝑑)2 20 30 443𝑐 𝑒 −𝑥𝑧
𝑎+
(a)
𝑐 �|𝑎𝑏|
(b) 𝑑
𝑑𝑒 � 2 � + 𝑎 + 𝑏 (c)
2𝑥 3
+
(𝑥 + 𝑧)
(𝑎 + 𝑏 + 𝑐 + 𝑑)
4. Two trigonometric identities are given by

𝑥 1 + 𝑐𝑜𝑠𝑥
(a) 𝑠𝑖𝑛2𝑥 = 2𝑠𝑖𝑛𝑥 𝑐𝑜𝑠𝑥 (b) 𝑐𝑜𝑠 =�
2 2

2𝑡𝑎𝑛𝑥 𝑥 1 − 𝑐𝑜𝑠𝑥
(c) 𝑡𝑎𝑛2𝑥 = (d) 𝑡𝑎𝑛 =�
1 − 𝑡𝑎𝑛2 𝑥 2 1 + 𝑐𝑜𝑠𝑥

For each part, verify that the identity is correct by calculating each side of the equation,
5
substituting 𝑥 = 24 𝜋.

5. The distance d from a point (x0, y0) to a line Ax + By + C = 0 is given by:

3
|𝐴𝑥0 + 𝐵𝑦0 + 𝐶|
𝑑=
√𝐴2 + 𝐵 2
Determine the distance of the point (2, -3) from the line 3x + 5y - 6 = 0.
6. If 𝑧1 = 2 + 3𝑖 and 𝑧2 = 4 − 5𝑖, determine
1
(a) (5𝑧1 + 3𝑧2 )2 (b) 𝑧�1 𝑧�2 (c) 𝑅𝑒 � �
𝑧1 2
𝑧2
(d) (e) 𝐼𝑚(𝑧2 2 )
𝑧1
7. Flowers are packed in boxes such that a dozen are placed in each box. Determine how many
boxes are needed to pack 751 flowers, using ceil function.

8. Calculate the radius r of a sphere that has volume of 350 cm3. Once r is determined, use it to
calculate the surface area of the sphere.
9. Define the following variables:
table_price = $ 256.95
chair_price = $ 89.75
Then change the display format to bank and:
(a) Evaluate the cost of two tables and eight chairs.
(b) Evaluate the cost of two tables and eight chairs if 10 % services tax is added.
(c) Convert the total cost to Nepali rupees ($1 = Rs 95) and round the total cost.
10. The magnitude M of an earthquake on the Richter scale is given by

2 𝐸
𝑀= 𝑙𝑜𝑔
3 𝐸0

where, E is the energy released by the earthquake, and E0 (= 104.4 J) is a constant (energy of a
small reference earthquake). Determine how many times more energy is released from an
earthquake that registers 7.2 on the Richter scale than an earthquake that registers 5.3.
11. The two forces P and Q act on a bolt A. Determine their resultant.

𝑅 = �𝑃2 + 𝑄 2 − 2𝑃𝑄𝑐𝑜𝑠𝜃

4
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 2
BASIC MATHEMATICS II

1. Factorize the following algebraic expressions


(a) 𝑥 2 + 5𝑥 + 6 (b) 𝑥 3 − 8 (c) 𝑥 4 − 𝑦 4
2. Use simplify to simplify the following expressions:
𝑥3 − 𝑦3
(a) (b) cos2x − sin2x
𝑥−𝑦
1

1 1
�1 + − 𝑡𝑎𝑛2 𝑥
1 �
(c) (d)
�1 + 𝑥� 𝑐𝑜𝑠 2 𝑥

3. Use either solve or fzero, as appropriate, to solve the following equations:


(a) 8x2 -5x + 3 = 0
(b) x3 + px + q = 0 (Solve for x in terms of p and q)
(c) ex = 8x − 4.
4. Solve (symbolically) the system of linear equations
3x + 4y =7
2x − 3y = 16
5. Solve (symbolically) the system of linear equations
x2 − y =2
−2x + y = 16
6. Solve (symbolically) the system of linear equations
3x + 4y + 5z = 2
2x − 3y + 7z = −1
x − 6y + z =3
7. Solve (symbolically) the system of linear equations
w + 3x − 3z = 30
4x − 5y + 2z = 13
2w + 8x − 4y +3z = 42
3w + y − 5z = 35
8. The following polynomials are given:

5
p1(x) = x5 + 2x4 – 3x3 + 7x2 – 8x + 7
p2(x) = x4 + 3x3 – 5x2 + 9x + 11
p3(x) = x3 – 2x2 – 3x + 9
p4(x) = x2 – 5x + 13
p5(x) = x + 5
Evaluate the expressions at x = 2.
9. Consider the polynomials
p1(s) = s3 + 5s2 + 3s + 10
p2(s) = s4 + 7s3 + 5s2 + 8s + 15
p3(s) = s5 + 15s4 + 10s3 + 6s2 + 3s + 9
Determine:
(a) p1(s) p2(s) p3(s)
(b) p1(s) p2(s)/p3(s)
(c) p1(1), p2(2), and p3(3)

10. Determine the roots of the following polynomials:


p1(x) = x7 + 8x6 + 5x5 + 4x4 + 3x3 + 2x2 + x + 1
p2(x) = x6 – 7x6 + 7x5 + 15x4 – 10x3 – 8x2 + 7x + 15
p3(x) = x5 – 13x4 + 10x3 + 12x2 + 8x – 15
p4(x) = x4 + 7x3 + 12x2 – 25x + 8
p5(x) = x3 + 15x2 – 23x + 105
p6(x) = x2 – 18x + 23
p7(x) = x + 7

6
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 3
CREATING ARRAYS

1. (a) Create a row vector that has the elements: 32, 4, 81, e2.5, 63, cos(𝜋/3) and 14.12.
(b) Create a column vector that has the elements: 55, 14, ln(51), 987, 0 and 5sin(2.5 𝜋).
(c) Create a row vector in which the first element is 1, the last element is 33, with an
increment of 2 between the elements.
(d) Create a column vector in which the first element is 15, the last element is – 25, with
an increment of – 5 between the elements.
(e) Create a row vector with 15 equally spaced elements in which the first element is 7
and the last element is 40.
(f) Create a column vector with 12 equally spaced elements in which the first element is –
1 and the last element is – 15.
2. Create a vector A1 that has 16 elements in which the first element is 4, the increment is 3 and
the last element is 49. Then, using the colon symbol, create a new vector A2 that has eight
elements. The first four elements of A2 are the first four elements of the vector A1 and the
last four are the last four elements of the vector A1.
3. Create the matrix shown below by creating vector rows.
1 4 7 10 13 16 19 22 25
𝐴 = �72 66 60 54 48 42 36 30 24 �
0 0.125 0.250 0.375 0.500 0.625 0.750 0.875 1.000
4. Create the following matrix 𝐵:
6 43 2 11 87
𝐵 = �12 6 34 0 5�
34 18 7 41 9
Use the matrix 𝐵 to:
(a) Create a five-element row vector named 𝐵1 that contains the elements of the second row
of 𝐵.
(b) Create a three-element row vector named 𝐵2 that contains the elements of the fourth
column of 𝐵.
(c) Create a ten-element row vector named 𝐵3 that contains the elements of the first and
second rows of 𝐵.
(d) Create a six-element row vector named 𝐵4 that contains the elements of the second and
fifth columns of 𝐵.
5. Create the following matrix 𝐶:
2 4 6 8 10
𝐶 = �3 6 9 12 15�
7 14 21 28 35
Use the matrix 𝐶 to:

7
(a) Create a three-element column vector named 𝐶1 that contains the elements of the third
column of 𝐶.
(b) Create a five-element column vector named 𝐶2 that contains the elements of the second
row of 𝐶.
(c) Create a nine-element column vector named 𝐶3 that contains the elements of the first,
third and fifth columns of 𝐶.
(d) Create a ten-element column vector named 𝐶4 that contains the elements of the first and
second rows of 𝐶.
6. Create the following matrix 𝐴:
1 2 3 4 5 6 7
2 4 6 8 10 12 14
𝐴=� �
21 18 15 12 9 6 3
5 10 15 20 25 30 35
(a) Create a 3 × 4 matrix 𝐵 from the first, third and fourth rows and the first, third through
seventh columns of the matrix 𝐴.
(b) Create a fifteen-element row vector named 𝑈 from the elements of the third row, and the
fifth and seventh columns of the matrix 𝐴.
7. Create the following matrices.
0 0 0 0 0 1 0 0 0 1 1
0 0 0 0 0 0 1 0 0 1 1
(a) � � (b) � � (c) � �
0 0 0 0 0 0 0 1 0 1 1
0 0 0 0 0 0 0 0 1 1 1
8. Create a 3 × 4 matrix 𝐴 in which all the elements are 1, and create a 2 × 2 matrix 𝐵 in which
all the elements are 5. Then, add elements to the matrix 𝐴 by appending the matrix 𝐵 such
that 𝐴 will be:
1 1 1 0 0
⎡1 1 1 0 0⎤
⎢ ⎥
𝐴 = ⎢1 1 1 0 0⎥
⎢0 0 0 5 5⎥
⎣0 0 0 5 5⎦

9. Create matrix G is created by putting matrices A, B, and C given above, on its diagonal.
2 6 0 0 0 0
⎡3 9 0 0 0 0⎤
⎢ ⎥
0 0 1 2 0 0⎥
𝐺=⎢
⎢0 0 3 4 0 0⎥
⎢0 0 0 0 −5 5⎥
⎣0 0 0 0 5 3⎦

8
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 4
OPERATION OF ARRAYS

1. Two vectors are given:


𝒖 = 4𝒊 + 9𝒋 − 5𝒌 and 𝒗 = −3𝒊 + 6𝒋 − 7𝒌
(a) Define u as a row vector and v as a column vector, and then use multiplication to
determine the dot product.
(b) Use the dot function and verify the result obtained in (a).
(c) Determine their cross product.
2. For the function 𝑦 = (𝑥 2 + 1)𝑥 3 , calculate the value of y of the following values of x: - 2.5,
-2, - 1.5, - 1, - 0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3.
3. Show that
1 𝑛
lim �1 + � = 𝑒
𝑛→∞ 𝑛

Do this by first creating a vector n that has elements: 1, 10, 100, 500, 1000, 2000, 4000 and
8000. Then create a new vector y in which each element is determined from the elements of n
1 𝑛
by �1 + 𝑛� .

4. Use MATAB to show that the sum of the infinite series

1

(2𝑛 + 1)(2𝑛 + 2)
𝑛=0

Converges to ln 2. Do this by computing the sum for:


(a) n = 50
(b) n = 500
(c) n = 5000
5. Enter the following three matrices in MATLAB and show that
1 2 3 12 −5 4 7 13 4
𝐴 = �−8 5 7� 𝐵 = � 7 11 6 � 𝐶 = �−2 8 −5�
−8 4 6 1 8 13 9 −6 11
(a) 𝐴 + 𝐵 = 𝐵 + 𝐴 (b) 7(𝐴 + 𝐶) = 7𝐴 + 7𝐶
(c) 𝐴 + (𝐵 + 𝐶) = (𝐴 + 𝐵) + 𝐶 (d) 𝐴(𝐵 + 𝐶) = 𝐴𝐵 + 𝐴𝐶

6. Consider the following two matrices:

9
1 0 1 7 4 2
𝐴=� 2 3 4� and 𝐵 = � 3 5 6�
−1 6 7 −1 2 1

Using MATLAB, determine the following:


(a) 𝐴 + 𝐵 (b) 𝐴𝐵 (c) 𝐴2 (d) 𝐴′
(e) 𝐵 −1 (f) 𝐵′𝐴′ (g) 𝐴2 + 𝐵 2 − 𝐴𝐵 (h) |𝐴|
(i) |𝐵| (j) |𝐴𝐵|

7. Find the rank and inverse of the following matrices:


3 2 1 1 6 3 −1 −2 5
(a) 𝐴 = �−1 5 4 � (b) 𝐵 = �−4 −5 7� (c) 𝐶 = �−4 7 2�
5 7 −9 8 4 2 7 −8 −1
8. Determine the eigenvalues and eigenvectors of the following matrices using MATLAB.
1 −2 1 5
(a) � � (b) � �
1 3 −2 4
4 −1 5 3 5 7
(c) �2 1 3� (d) �2 4 8 �
6 −7 9 5 6 10
3 0 2 1 1 3 5 7
1 2 5 4 2 −1 −2 4
(e) � � (f) � �
7 −1 2 6 3 2 1 1
1 −2 3 4 4 1 0 6
9. Solve the following set of equations using MATLAB.
2𝑥 + 𝑦 − 3𝑧 = 11 2𝑥 − 𝑦 = 10
(a) 4𝑥 − 2𝑦 + 3𝑧 = 8 (b) −𝑥 + 2𝑦 − 𝑧 = 0
−2𝑥 + 2𝑦 − 𝑧 = −6 −𝑦 + 𝑧 = −50
10. Solve the following set of equations using MATLAB.
𝑥1 + 2𝑥2 + 3𝑥3 + 5𝑥4 = 21 𝑥1 + 2𝑥2 + 3𝑥3 + 4𝑥4 = 9
−2𝑥1 + 5𝑥2 + 7𝑥3 − 9𝑥4 = 17 2𝑥1 − 2𝑥2 − 𝑥3 + 𝑥4 = −5
(a) (b)
5𝑥1 + 7𝑥2 + 2𝑥3 − 5𝑥4 = 23 𝑥1 − 3𝑥2 + 4𝑥3 − 4𝑥4 = 7
−𝑥1 − 3𝑥2 − 7𝑥3 + 7𝑥4 = 26 2𝑥1 + 2𝑥2 − 3𝑥3 + 4𝑥4 = −6
11. Four forces act on bolt A as shown. Determine the resultant of the forces on the bolt.

10
12. A rectangular plate is supported by brackets at A and B and by a wire CD. Knowing that the
tension in the wire is 200 N, determine the moment about 80 mm A of the force exerted by
the wire on point C.

13. Let the state of stress at a point be given by 𝜎𝑥𝑥 = 120 𝑀𝑃𝑎, 𝜎𝑦𝑦 = 55 𝑀𝑃𝑎, 𝜎𝑧𝑧 =
−85 𝑀𝑃𝑎, 𝜎𝑥𝑦 = −55 𝑀𝑃𝑎, 𝜎𝑦𝑧 = −55 𝑀𝑃𝑎 and 𝜎𝑧𝑥 = −75 𝑀𝑃𝑎. Determine the three
principal stresses and the directions associated with them.
14. For the system shown in Figure, k1 = 2k, k2 = 3k, k3 = 2k, k4 = k and m1 = 2m, m2 = 3m and
m3 = m. Determine the natural frequencies and the corresponding mode shapes. Take k = 100
N/m and m=1 kg.

11
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 5
BASIC PROGRAMMING

1. Give values to variables a and b on the command line, e.g. a = 3 and b = 5. Write some
statements to find the sum, difference, product and quotient of a and b.
2. A light bulb is rated P Watt at V Volt. Write a program to determine the current through the
bulb and its resistance Take values of P and V from user.
3. Write a program to calculate petrol consumption. It should assign the distance traveled (in
kilometers) and the amount of petrol used (in liters) and compute the consumption in km/liter
as well as in the more usual form of liters per 100 km. Write some helpful headings, so that
your output looks something like this:
Distance Liters used km/L L/100km
528 46.23 11.42 8.76
4. If C and F are Celsius and Fahrenheit temperatures respectively, the formula for conversion
from Celsius to Fahrenheit is F =9C/5+32.
(a) Write a script which will ask you for the Celsius temperature and display the equivalent
Fahrenheit one with some sort of comment, e.g.
The Fahrenheit temperature is: ...
(b) Change the script to use vectors and array operations to compute and display the
Fahrenheit equivalent of Celsius temperatures ranging from 20◦ to 30◦ in steps of 1◦, in
two columns with a heading, e.g.
Celsius Fahrenheit
20.00 68.00
21.00 69.80
...
30.00 86.00
5. Generate a table of conversions from degrees (first column) to radians (second column).
Degrees should go from 00 to 3600 in steps of 100.

6. Set up a matrix (table) with degrees in the first column from 0 to 360 in steps of 30, sines in
the second column, and cosines in the third column.

7. Write some statements that display a list of integers from 10 to 20 inclusive, each with its
square root next to it.
8. Write some statements to find and display the sum of the successive even integers 2, 4, . . . ,
200.
9. Write a program to solve a simultaneous equation

12
ax + by = c
dx + ey = f .
The program should ask user to enter the coefficients a, b, c, d, e and f .
10. Write a program to display natural frequency, time period and response expression for the
vibration of a single degree of freedom system. Allow user to enter: mass, stiffness, initial
displacement and initial velocity.

13
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 6
PROGRAMMING WITH LOOPS

1. Write MATLAB programs to find the following sums with for loops.
(a) 12 + 22 + 32 + … … … + 10002 .
1 1 1 1
(b) 1 − 3 + 5 − 7 + ⋯ … … … . − 1003.

2. Suppose we have invested some money which draws 10 percent interest per year,
compounded. We would like to know how long it takes for the investment to double. Write a
program to produce a statement of the account each year, until the balance has doubled.

3. Write a script which inputs any two numbers (which may be equal) and displays the larger
one with a suitable message, or if they are equal, displays a message to that effect.

4. Suppose the Random Bank now offers 9 percent interest on balances of less than $5000, 12
percent for balances of $5000 or more but less than $10 000, and 15 percent for balances of
$10 000 or more. Write a program to calculate a customer’s new balance after one year.
Check the program for the balances of (a) $4000 (b) $8000 (c) $12000 (d) $16000.

5. The electricity accounts of residents in a very small town are calculated as follows:
(a) if 500 units or less are used the cost is 2 cents per unit;
(b) if more than 500, but not more than 1000 units are used, the cost is $10 for the first 500
units, and then 5 cents for every unit in excess of 500;
(c) if more than 1000 units are used, the cost is $35 for the first 1000 units plus 10 cents for
every unit in excess of 1000;
(d) in addition, a basic service fee of $5 is charged, no matter how much electricity is used.
Write a program which enters the following five consumptions into a vector, and uses a for
loop to calculate and display the total charge for each one: 200, 500, 700, 1000, 1500.

6. Write a script for the general solution of the quadratic equation ax2 +bx +c=0. Your script
should be able to handle all possible values of the data a, b, and c and give message about the
types of roots. Try it out on the following values of a, b and c:
(a) 1, 1, 1 ;
(b) 2, 4, 2 ;
(c) 2, 2, −12.

7. Write a script to convert seconds into hours, minutes and seconds. Try out your script for 10
000 seconds.

14
8. Take input for amount and unit of the currency. Covert it to the required another currency.
Use following exchange rates:
Currency Unit Exchange Rate (NRs)
Indian Rs 100 160
U S dollar 1 96.19
Euro 1 130.05
Pound Sterling 1 164.29

9. Write a script to take the value of 𝑥 and display the corresponding value of 𝑦 defined by the
function given below.
30√𝑥 + 10 𝑥≥9
𝑦 = � 10𝑥 + 10 0≤𝑥≤9
10 𝑥<0

10. The deflection of the beam shown in Figure due to a static load P is given by

𝑃𝑏𝑥 2
(𝑙 − 𝑏 2 − 𝑥 2 ) 0≤𝑥≤𝑎
𝑤(𝑥) = � 6𝐸𝐼𝑙
𝑃𝑎(𝑙 − 𝑥) 2
− (𝑎 + 𝑥 2 − 2𝑙𝑥) 𝑎 ≤ 𝑥 ≤ 𝑙
6𝐸𝐼𝑙

Write a program to take input for P, a, l, E, I to display deflection for a given point (x). Run
the program with a = 4 m, l = 10 m, E = 210 GPa, I = 4.9 × 10-6 m4 and calculate the
deflection at (a) x = 2 m, (b) x = 5 m, (c) x = 6 m, (d) x = 8 m.

11. Write a program to display natural frequency, time period and response expression for the
vibration of a damped single degree of freedom system. Allow user to enter: mass, stiffness,
damping, initial displacement and initial velocity. Also give message whether the system is
underdamped, overdamped or critically damped.

15
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 7
MATLAB GRAPHICS I

1. Make two separate plots of the function 𝑓(𝑥) = 0.6𝑥 5 − 5𝑥 3 + 9𝑥 + 2; one plot for
−4 ≤ 𝑥 ≤ 4, and −2.7 ≤ 𝑥 ≤ 2.7. Plot by creating vectors.
2. Plot the function
𝑥2 − 𝑥 + 1
𝑓(𝑥) = 2
𝑥 +𝑥+1
for −10 ≤ 𝑥 ≤ 10. Plot by creating vectors.
3. Use fplot command to plot the function 𝑓(𝑥) = 0.01𝑥 5 − 0.03𝑥 4 + 0.4𝑥 3 − 6𝑥 + 5; in the
domain −4 ≤ 𝑥 ≤ 6.
4. Plot the function 𝑓(𝑥) = 3𝑥𝑠𝑖𝑛𝑥 − 2𝑥 and its derivative, both on the same plot, for −2𝜋 ≤
𝑥 ≤ 2𝜋. Plot the function with a solid line and the derivative with a dashed line. Add a
legend and label the axes.
5. The position 𝑥 as function of time 𝑡 of a particle that moves along a straight line is given by
𝑥(𝑡) = 0.4𝑡 3 − 2𝑡 2 − 5𝑡 + 13 𝑚. Use subplot command to make the three plots on the
same page with the plot of position on the top, the velocity at the middle and the acceleration
at the bottom. Label the axes appropriately with the correct units.
6. The deflection 𝑦 at point 𝑥 of a beam loaded with a uniformly distributed load 𝑤 is given by
the equation:

−𝑤
𝑦= (𝑥 4 − 4𝐿𝑥 3 + 6𝐿2 𝑥 2 )
24𝐸𝐼

For the beam shown in figure, 𝐿 = 6𝑚, 𝐸 = 70 × 109 𝑃𝑎, 𝐼 = 9.19 × 10−6 𝑚4 and
𝑤 = 800 𝑁/𝑚. Make a plot of the deflection of the beam 𝑦 as a function of 𝑥.
7. Plot the functions x4 and 2x on the same graph and determine how many times their graphs
intersect. Now find the approximate values of the points of intersection using fzero.
8. Write a program to display natural frequency, time period and response curve for the
vibration of a damped single degree of freedom system. Allow user to enter: mass, stiffness,
damping, initial displacement and initial velocity.

16
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 8
MATLAB GRAPHICS II

1. Create appropriate x and y arrays to use in plotting each of the expressions that follow. Use
the subplot command to divide your figures into four sections, and create each of these four
graphs for each expression:
• Rectangular
• Semilogx
• Semilogy
• Loglog
(a) 𝑦 = 5𝑥 + 3
(b) 𝑦 = 3𝑥 2
(c) 𝑦 = 12𝑒 (𝑥+2)
(d) 𝑦 = 1/𝑥
Physical data usually are plotted so that they fall on a straight line. Which of the preceding
types of plot results in a straight line for each problem?
2. The magnitude M of an earthquake on the Richter scale is given by
2 𝐸
𝑀= 𝑙𝑜𝑔
3 𝐸0
where, E is the energy released by the earthquake and E0 (= 104.4 J) is a constant (energy of a
small reference earthquake). Make a plot of 𝐸 (ordinate) and 𝑀 (abscissa) for 3 ≤ 𝑀 ≤ 8.
Use a logarithmic scale for 𝐸 and a linear scale for 𝑀. Label the axes and add a title to the
plot.
3. Year wise pass percentage of the undergraduate students of Pulchowk Campus is given
below:
Year 2063 2064 2065 2066 2067 2068 2069 2070
Pass (%) 88 65 45 75 56 89 72 85
Present the given data in
(a) vertical bar diagram
(b) horizontal bar diagram
(c) stairs diagram, and
(d) stem diagram.
4. Composition of faculties of Pulchowk Campus is given below:
Status Number
Professor 43
Associate professor 59
Lecturer 65

17
Instructors 22
Chief Instructor 12
Senior Instructor 7
Present the given data in Pie diagram.
5. In the following table the weights of 40 male students at State University are recorded to the
nearest pound. Construct a histogram.
138 164 150 132 144 125 149 157
146 158 140 147 136 148 152 144
168 126 138 176 163 119 154 165
146 173 142 147 135 153 140 135
161 145 135 142 150 156 145 128
6. Use contour to do the following:
(a) Plot the level curves of the function f (x, y) = 3y + y3 − x3 in the region where x and y are
between −1 and 1.
(b) Plot the curve 3y + y3 − x3 = 5.
7. Create a polar plot of the function 𝑟(𝜃) = 3𝑐𝑜𝑠 2 (0.5𝜃) + 𝜃 for 0 ≤ 𝜃 ≤ 2𝜋.
8. Use the following functions for plotting 𝑥 − 𝑦 data
(a) 𝑥 = 2𝑐𝑜𝑠𝑡 𝑦 = 2𝑠𝑖𝑛𝑡 0 ≤ 𝑡 ≤ 2𝜋
(b) 𝑥 = 𝑒𝑡 𝑦 = 100 + 𝑒 3𝑡 0 ≤ 𝑡 ≤ 2𝜋
9. Plot the parametric space curve of
(a) 𝑥=𝑡 𝑦 = 𝑡2 𝑧 = 𝑡3 0≤𝑡≤2
(b) 𝑥 = √𝑡 𝑠𝑖𝑛3𝑡 𝑦 = √𝑡 𝑐𝑜𝑠3𝑡 𝑧 = 0.8𝑡 0 ≤ 𝑡 ≤ 6𝜋
7
(c) 𝑧=− |𝑥| ≤ 5, |𝑦| ≤ 5
1 + 𝑥2 + 𝑦2
10. Obtain the mesh and surface plots of the function
2 +𝑦 2
𝑧 = 2−1.5�𝑥 sin(𝑥) cos(0.5𝑦)

over the domain −4 ≤ 𝑥 ≤ 4 and −4 ≤ 𝑦 ≤ 4.

18
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 9
POLYNOMIAL, CURVE FITTING AND INTERPOLATION

1. For the polynomial 𝑓(𝑥) = 𝑥 5 − 13𝑥 4 + 10𝑥 3 + 12𝑥 2 + 8𝑥 − 15


(a) Calculate 𝑓(6).
(b) Plot the polynomial for 0.5 ≤ 𝑥 ≤ 1.5.
(c) Determine its all roots.

2. The roots of a polynomial are found to be 6.5, 4, 2.3, −1.2 and 0.5. Determine the
polynomial.

3. Two polynomials are given:


𝑓1 (𝑥) = 3𝑥 6 + 15𝑥 5 − 10𝑥 3 − 3𝑥 2 + 15𝑥 − 40 and 𝑓2 (𝑥) = 3𝑥 3 − 2𝑥 − 6
(a) Determine the sum of 𝑓1 (𝑥) and 𝑓2 (𝑥).
(b) Determine the difference of 𝑓1 (𝑥) and 𝑓2 (𝑥).
(c) Determine the product of 𝑓1 (𝑥) and 𝑓2 (𝑥).
(d) Divide 𝑓1 (𝑥) by 𝑓2 (𝑥).

4. Two polynomials are given:


𝑓1 (𝑥) = 3𝑥 2 − 2𝑥 + 4 and 𝑓2 (𝑥) = 𝑥 2 + 5
(a) Determine the derivatives of 𝑓1 (𝑥) and 𝑓2 (𝑥) respectively.
(b) Determine the derivatives of the product of 𝑓1 (𝑥) and 𝑓2 (𝑥).
(c) Determine the derivatives of 𝑓1 (𝑥)/𝑓2 (𝑥).

5. The following data are given


x −5 −4 −2.2 −1 0 1 2.2 4 5 6 7
y 0.1 0.2 0.8 2.6 3.9 5.4 3.6 2.2 3.3 6.7 8.9
(a) Fit the data with a first-order polynomial. Make a plot of the points and the polynomial.
(b) Fit the data with a third-order polynomial. Make a plot of the points and the polynomial.
(c) Fit the data with a fifth-order polynomial. Make a plot of the points and the polynomial.
(d) Fit the data with an eighth-order polynomial. Make a plot of the points and the
polynomial.

6. The population a country from the year 1940 to 2000 is given in the following table:
Year 1940 1950 1960 1970 1980 1990 2000
Population
537 557 682 826 981 1135 1262
(millions)

19
(a) Determine the exponential function that best fits the data and use the function to estimate
the population in 1955.
(b) Fit the data with a second order polynomial and use the function to estimate the
population in 1955.

7. Determine 𝑏 and 𝑚 so that 𝑓(𝑥) = 𝑏𝑥 𝑚 fits the following data in the least-squares sense.
x 0.5 1.0 1.5 2.0 2.5
y 0.49 1.60 3.36 6.44 10.16
8. The standard air density ρ at different heights ℎ from sea level is given below:
ℎ (𝑘𝑚) 0 3 6 9 12 15
ρ (𝑘𝑔/𝑚3 ) 1.2 0.91 0.66 0.47 0.31 0.19
ℎ (𝑘𝑚) 18 21 24 27 30 33
ρ (𝑘𝑔/𝑚3 ) 0.12 0.075 0.046 0.029 0.018 0.011

Make the following four plots (pressure as a function of height) and compare with the given
data points:
(a) both axes with linear scale,
(b) ℎ with log axis 𝐷 with linear axis,
(c) ℎ with linear axis 𝐷 with log axis,
(d) both log axes.

9. Properties of a saturated water vapor at 100 kPa are given below.


P T v u h s
0
kPa C m3/kg kJ/kg kJ/kg kJ/kg.K
100 (99.63) (1.6943) (2505.7) (2675.1) (7.3589)
100 1.6961 2506.3 2675.9 7.3609
150 1.9364 2582.4 2776.1 7.6129
200 2.1723 2657.6 2874.8 7.8335
250 2.4061 2733.3 2973.9 8.0325
300 2.6388 2810.1 3073.9 8.2152
350 2.8709 2888.2 3175.3 8.3846
400 3.1027 2967.7 3278.0 8.5432
450 3.3342 3048.9 3382.3 8.6927
500 3.5655 3131.6 3488.2 8.8342
Using linear interpolation, determine:
(a) specific volume (v) at 1200C,
(b) specific internal energy (u) at 1600C,
(c) specific enthalpy (h) at 2350C, and
(d) specific entropy (s) at 3250C.

20
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 10
CALCULUS AND APPLICATIONS

1. Find the derivatives of the following and if possible, simplify each answer:
(a) f(x) = 6x3 − 5x2 + 2x – 3
2𝑥 − 1
(𝒃) 𝑓(𝑥) =
𝑥2 + 1
(c) f(x) = sin(3x2 + 2)
(d) f(x) = arcsin(2x + 3)
(e) 𝑓(𝑥) = √1 + 𝑥 4
(f) f(x) = xr
(g) f(x) = arctan(x2 + 1).

2. See whether MATLAB can do the following integrals symbolically, and for the indefinite
integrals, check the results by differentiating:
𝜋�
(a) ∫0 2 𝑐𝑜𝑠𝑥 𝑑𝑥
(b) ∫ 𝑥 𝑠𝑖𝑛(𝑥 2 )𝑑𝑥
(c) ∫ sin(3𝑥)�1 − cos(3𝑥)𝑑𝑥
(d) ∫ 𝑥 2 √𝑥 + 4 𝑑𝑥
∞ 2
(e) ∫−∞ 𝑒 −𝑥 𝑑𝑥

3. Evaluate the following limits:


1 + 𝑐𝑜𝑠𝑥
(𝐚) lim
𝑥→−𝜋 𝑥 + 𝜋

(𝐛) lim 𝑥 2 𝑒 −𝑥
𝑥→∞

4. Find the Taylor polynomial of the indicated degree n at the indicated point c for the
following functions:
(a) f(x) = ex, n = 6, c = 0
(b) f(x) = sinx, n = 4 and n = 6, c = 0
(c) f(x) = sinx, n = 5, c = 2

21
(d) f(x) = tanx, n = 6, c = 0
(e) f(x) = lnx, n = 4, c = 1

5. Obtain the general solution of the following first order differential equations:
𝑑𝑦 𝑑𝑦
(a) = −7𝑥 2 (b) = 5𝑥𝑐𝑜𝑠 2 𝑦
𝑑𝑥 𝑑𝑥
𝑑𝑦 𝑑𝑦
(c) = −𝑦 + 𝑒 3𝑥 (d) + 5𝑦 = 35
𝑑𝑥 𝑑𝑡

6. Determine the solutions of the following first-order ordinary differential equations using
MATLAB’s symbolic mathematics.
(a) 𝑦̇ = 8𝑥 2 + 5; 𝑦(0) = 0.5 (b) 𝑦̇ = 5𝑥 𝑠𝑖𝑛2 𝑦; 𝑦(0) = 𝜋/5
(c) 𝑦̇ = 7𝑥 𝑐𝑜𝑠 2 𝑦; 𝑦(0) = 2 (d) 𝑦̇ = −5𝑥 + 𝑦; 𝑦(0) = 3
(e) 𝑦̇ == 3𝑦 + 𝑒 −5𝑥 ; 𝑦(0) = 2

7. For the following differential equations, use MATLAB to find x(t) when x(0) = 1 and 𝑥̇ (0) =
–1.
(a) 𝑥̈ + 10𝑥̇ + 5𝑥 = 11 (b) 𝑥̈ − 7𝑥̇ − 3𝑥 = 5
(c) 𝑥̈ + 3𝑥̇ + 7𝑥 = −15 (d) 𝑥̈ + 𝑥̇ + 7𝑥 = 26

8. Solve the first-order ordinary differential equations given in Problem 6 numerically using
ODE solver.

22
ENGINEERING PROBLEM SOLVING WITH MATLAB AND MAPLE

EXERCISE 11
SIMULINK

1. Use the Simulink to solve the following problems 0 ≤ 𝑡 ≤ 15:


𝑑𝑦
(a) = 10 𝑠𝑖𝑛𝑡; 𝑦(0) = 0
𝑑𝑡
𝑑𝑦
(b) + 10𝑦 − 2 𝑠𝑖𝑛4𝑡 = 0; 𝑦(0) = 1
𝑑𝑡
(c) 3𝑥̈ + 8𝑥̇ + 10𝑥 = 0, 𝑥(0) = 5, 𝑥̇ (0) = 3
(d) 𝑥̈ + 𝑥̇ + 2𝑥 = 5𝑠𝑖𝑛𝑡, 𝑥(0) = 1, 𝑥̇ (0) = −1

2. Use the Simulink to verify Fourier series expansion of the following functions:

(a)

(b)

23

View publication stats

You might also like