You are on page 1of 4

ENG-COMP/Task 8/May 10th

__________________________________________________________________________________

 Please do this task in the editor window and save it as a M-file script with the file name :
yourname_NIM_task8
 Your file should include appropriate comments (%) to identify each problem and to describe
your calculation process.
 Please start your script with the comments:
% Name :
% NIM :
% Task #8
 Divide each problem script using cell mode (%%).
 When you finish, send the M-files to martinus.dewa@sampoernauniversity.ac.id before
Thursday, May 12th, at 08.00, with the subject : [ENG-COMP] Task 8
 Late submission will not be accepted and automatically be graded as 0.
 The submission of assignment for those who don’t come with a permission letter will be
announce later.
 Wrong format (file name, script’s beginning, email subject, and file format) will result in
points deduction.

1. (a) Create a padded character array with five different names.


(b) Create a two-dimensional array called birthdays to represent the birthday of each
person. For example, your array might look something like this:

birthdays=
6 11 1983
3 11 1985
6 29 1986
12 12 1984
12 11 1987

(c) Use the num2str function to convert birthdays to a character array.


(d) Use the disp function to display a table of names and birthdays.

Answer :
2. Create a cell array called sample_cell to store the following individual arrays:

(a) Extract array A from sample_cell.


(b) Extract the information in array C , row 3, from sample_cell .
(c) Extract the name fred from sample_cell . Remember that the name fred is a 1 x 4
array, not a single entity.

Answer :
3. Find the kinetic energy of a car that weighs 2000 lbm and is traveling at 60 mph (see
Figure). Your units will be lbm mile2/h2. Once you’ve calculated this result, change it to
Btu by using the following conversion factors:

Answer:
4. Determine the first and second derivatives of the following functions, using MATLAB’s
symbolic functions:
a. 𝑓1 (𝑥) = 𝑦 = 𝑥 3 − 4𝑥 2 + 3𝑥 + 8
b. 𝑓2 (𝑥) = 𝑦 = (𝑥 2 − 2𝑥 + 1)(𝑥 − 1)
c. 𝑓3 (𝑥) = 𝑦 = cos(2𝑥) sin(𝑥)
2
d. 𝑓4 (𝑥) = 𝑦 = 3𝑥𝑒 4𝑥

5. Use MATLAB’s symbolic functions to perform the following integrations:

6. Consider a gas in a piston–cylinder device in which the temperature is held constant. As


the volume of the device was changed, the pressure was measured. The volume and
pressure values are reported in the following table:

(a) Use linear interpolation to estimate the pressure when the volume is 3.8 m3.

(b) Use cubic spline interpolation to estimate the pressure when the volume is 3.8 m3.

(c) Use linear interpolation to estimate the volume if the pressure is measured to be 1000
kPa.

(d) Use cubic spline interpolation to estimate the volume if the pressure is measured to be
1000 kPa.

You might also like