Beruflich Dokumente
Kultur Dokumente
__________________________________________________________________________________
Please do this task in the editor window and save it as a M-file script.
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 #4
Divide each problem script using cell mode (%%).
When you finish, send the M-file to martinus.dewa@sampoernauniversity.ac.id before
10.40AM today with the subject : [ENG-COMP] Task 4
You can open course presentation slide, your book, and browse everything from internet to
get the data you need. You may discuss with your peers but copying MATLAB® script code
is strictly prohibited. (I will know if you do it).
You can leave the class as soon as you finished the task.
_________________________________________________________________________________
Create MATLAB script to calculate the following problems (input answer that can’t be
executed in a commentaries):
a. 𝑦 = 𝑒𝑥
b. 𝑦 = sin(𝑥)
c. 𝑦 = 𝑎𝑥 2 + 𝑏𝑥 + 𝑥, where a=5, b=2, and c=4
d. 𝑦 = √𝑥
Each of your plots should include a title, an x -axis label, a y -axis label, and a grid.
Combine the plots into one figure with four subwindows, using the subplot function of
MATLAB
Answer :
2. Plot the following functions on the sampe graph for x values from –π to π, selecting spacing
to create a smooth plot:
𝑦1 = sin(𝑥)
𝑦2 = sin(2𝑥)
𝑦3 = sin(3𝑥)
Answer :
3. A tensile testing machine such as the one shown in Figure 1 is used to determine the behavior
of materials as they are deformed. In the typical test, a specimen is stretched at a steady rate.
The force (load) required to deform the material is measured, as is the resulting deformation.
An example set of data measured in one such test is shown in Table 1. These data can be used
to calculate the applied stress and the resulting strain with the
following equations.
𝐹 𝑙−𝑙0
𝜎= and 𝜀 =
𝐴 𝑙0
where
ε = strain in in./in.
l = sample length
Answer :
4. For many metals, deformation changes their physical properties. In a process called cold
work, metal is intentionally deformed to make it stronger. The following data tabulate both
the strength and ductility of a metal that has been cold worked to different degrees:
Plot the data from table 2 (or load cold_work.dat) a single x – y plot with two y -axes. Be sure
to label both y -axes.
Answer:
5. Create x and y vectors from -5 to +5 with a spacing of 0.5. Use the meshgrid function to map
x and y onto new two-dimensional matrices called X and Y.
𝑍 = sin √𝑋 2 + 𝑌 2
Answer:
(b) Use the surf plotting function to create a three-dimensional plot of Z . Compare the results
you obtain with a single input ( Z ) with those obtained with inputs for all three dimensions
(X, Y, Z) .
Answer:
(c) Modify your surface plot with interpolated shading. Try using different colormaps (pick
any colormap you want).
Answer: