0% found this document useful (0 votes)
17 views15 pages

Test 1

The document outlines a test for fourth-year students in various engineering disciplines at Yangon Technological University, focusing on computer applications in engineering. It includes problems related to MATLAB programming, trigonometric calculations, linear equations, hyperbolic functions, and Fibonacci numbers, along with specific instructions for submission. The test is scheduled for January 26, 2024, and consists of multiple programming tasks that require the application of mathematical concepts and MATLAB coding skills.

Uploaded by

kaunghtwai3112
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views15 pages

Test 1

The document outlines a test for fourth-year students in various engineering disciplines at Yangon Technological University, focusing on computer applications in engineering. It includes problems related to MATLAB programming, trigonometric calculations, linear equations, hyperbolic functions, and Fibonacci numbers, along with specific instructions for submission. The test is scheduled for January 26, 2024, and consists of multiple programming tasks that require the application of mathematical concepts and MATLAB coding skills.

Uploaded by

kaunghtwai3112
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Yangon Technological University

Department of Mechanical Engineering


2024-2025 Academic Year (First Semester)
Test I
for
Fourth Year BE. (Mech, Petro, ChE,Tex)
Computer Application in Engineering (ME 41019)

Roll No IV.ChE-1
Name Kaung Htet Wai
Major Chemical Engineering
Date 23.1.2025

Problem No Marks
I (Quiz)
1
2
3
4
5
6
Total Marks
Yangon Technological University
Department of Mechanical Engineering
Computer Application in Engineering (ME 41019)
Test I

Date: 26.1.2024 8:00 AM – 11:00 AM


Attempt All. B.E 4th Year First Semester
One-hour additional time is allowed to prepare the Answer in Microsoft Word and
upload to the LMS system. 11:00 AM – 12:00 AM.
Quiz (20 Marks) must be submitted through LMS system.

1. Perform the following statements in the command windows and present the outputs
from command windows.
(a) Calculate:
sin(0.2 π)
(i) + tan72 °
cos(π /6)
2
(ii) ( tan64 ° cos 15° ) + sin 237 °
cos 20 °
(b) Two trigonometric identities are given by:
(iii) cos 2 x−sin 2 x=1−sin2 x
tan x 1
(iv) =
sin x−2 tan x cos x −2
For each part, verify that the identity is correct by calculating the values of the
left and right sides of the equation, substituting x = π/10
(c) Create the following three row vectors: a=[5 8 -1 0 2], b=[4 1 9 -2 3], and
c=[-3 5 0 6 1].
(v) Use the three vectors in a MATLAB command to create a
nine-element row vector consisting from the first three
elements of the vectors a, b, and c, respectively (i.e., 5 8 -1
4 1 9 -3 5 0).
(vi) Use the three vectors in a MATLAB command to create a
nine-element column vector consisting from the last
three elements of the vectors a, b, and c, respectively.
(d)Using the zeros, ones, and eye commands, create the following
arrays by typing one command:

[ ] [ ]
1 0 01 0 0 1001
(vii) A= 0 1 0 01 0
0 0 1 0 01
B=
0 0 01 1 [
0 0 01 1 C=
]
1000
1000
(20 Marks)

Page 1 of 4
Page 2 of 4
2. A food company manufactures five types of 8-oz trail mix packages using different
mixtures of peanuts, almonds, walnuts, raisins, and M&Ms. The mixtures have the
following compositions:

How many packages of each mix can be manufactured if 105 lb of peanuts, 74 lb of


almonds, 102 lb of walnuts, 118 lb of raisins, and 121 lb of M&Ms are available?
Write a system of linear equations and solve. Display the results in table format in
command window. (1 lb = 16 oz)
(5 Marks)

3. Hyperbolic cosine The hyperbolic cosine function is defined by the equation


x −x
e +e
cosh x=
2
Write a program (.m file) to calculate the hyperbolic cosine of a user-supplied value
x. Use the program to calculate the hyperbolic cosine of 3.0. Compare the answer that
your program produces to the answer produced by the MATLAB intrinsic function
cosh(x). Also, use MATLAB to plot the function cosh(x). What is the smallest value
that this function can have? At what value of x does it occur?
(5 Marks)

4. Create an array of 100 input samples in the range 1 to 100 using the linspace function,
and plot the equation
y(x) = 20 log10(2x)
on a semilogx plot. Draw a solid blue line of width 2, and label each point with a red
circle. Now create an array of 100 input samples in the range 1 to 100 using the
logspace function, and plot Equation on a semilogx plot. Draw a solid dash line of
width 2, and label each point with a black star. Be sure to include a title and axis
labels, and include the equation for the function being plotted in the title string.
(Note that you will need stream modifiers to get the italics and the superscripts in the
title string.) Save the Figure as png or jpeg format.

(20 Marks)

5. The value of π can be estimated from:


∞ n
π3 (−1)
=∑
32 n=0 (2 n+1)3

Page 3 of 4
Write a program (using a loop) that determines for a given number of terms n . Run
the program with n = 10, n = 100, and n = 1,000. Compare the result with pi. (Use
format long.)
(10 Marks)

6. Fibonacci Numbers The nth Fibonacci number is defined by the following recursive
equations:
f (1) = 1
f (2) = 1
f (n) = f (n – 1) + f (n – 2) if n < 2
Therefore, f (3) = f (2) + f (1) = 2+1=3, and so forth for higher numbers. Write an M-
file to calculate and write out the nth Fibonacci number for n > 2, where n is input by
the user. Use a while loop to perform the calculation. Show the results for n = 1:10
using for loop.
Follow the steps of the program design process to produce reliable, understandable
MATLAB programs.
1. State the problem,
2. Define the inputs and outputs,
3. Design the algorithm
4. Turn the algorithm into MATLAB statements.
5. Testing with the program with various input.

Your results should be look like below:


Fibonacci Number for 1 term = 1
Fibonacci Number for 2 term = 2
Fibonacci Number for 3 term = 3
Fibonacci Number for 4 term = 5
Fibonacci Number for 5 term = 8
Fibonacci Number for 6 term = 13
Fibonacci Number for 7 term = 21
Fibonacci Number for 8 term = 34
Fibonacci Number for 9 term = 55
Fibonacci Number for 10 term = 89
(20 Marks)
_____________________________________________________________________
*** Assume any necessary or missing data ***
End of Question

Page 4 of 4
Some useful MATLAB Stream Modifier

Page 5 of 4
1.(a) and 1.(b)

1.(c)(i) and 1.(c)(ii)

Page 6 of 4
1.(d)(i) and 1.(d)(ii)

1.(e)(iii)

Page 7 of 4
2.

Page 8 of 4
3.

5.

Page 9 of 4
6.
1. State the problem

The program must:

1. Accept user inputs for:


o Type of car (Sedan or SUV)
o Duration of rental (in days)
o Number of miles driven.
2. Compute the total rental cost based on:
o Daily rate for the car type.
o Cost for additional miles exceeding the daily free mileage limit.
3. Display the total cost rounded to two decimal places.

2. Define the inputs and outputs


Inputs:

1. Type of car (Sedan or SUV).


2. Duration of rental (in days).
3. Number of miles driven.

Outputs:

1. Total rental cost, rounded to two decimal places.

3: Design the algorithm

1. Prompt the user for the car type, rental duration, and miles driven.
2. Determine the daily rate, free miles, and cost per additional mile based on the rental
duration and car type using conditional logic.
3. Calculate the total rental cost:

Page 10 of 4
o Determine whether miles exceed the free mileage allowance for the rental
period.
o Add the daily rate cost and any additional mileage cost.
4. Display the total cost.

4.Turn the algorithm into MATLAB statements.

Page 11 of 4
Page 12 of 4
4.

Page 13 of 4
Page 14 of 4

You might also like