You are on page 1of 2

Introduction to Matlab

UCM-CompuMate Practice 2 March 21, 2019

Problem 1
Find the volume of a cylinder of height h and radius a. What is the volume of a cylinder
with radius a = 3.5 inches and height h = 5 inches?

Problem 2
Create a MATLAB script file to calculate and plot the derivative of the function y(x) =
e−x sin(3x) from 0 ≤ x ≤ 4 using the Forward Difference Method described below. You must
use a f or loop to solve this problem. Provide a plot title and labels for the axes. Use 101
points from x = 0 to x = 4.

dy y3 − y2
=
dx F 2 x3 − x2

1
Introduction to Matlab
UCM-CompuMate Practice 2 March 21, 2019

Problem 3
A block of metal is heated to a temperature of 300 degrees F, and allowed to cool over a
period of 7 hours as shown here:

Time(hours) Temperature(F)
0 300
0.5 281
1.0 261
1.5 244
2.0 228
2.5 214
3.0 202
3.5 191
4.0 181
5.0 164
6.0 151
6.1 149
7.0 141
Try a third order polynomial fit to the data and estimate how good the fit is.

Problem 4
Indexing is an alternative to sorting a vector. With indexing, the vector is left in its
original order. An index vector is used to point to the values in the original vector in
the desired order. Write a function to create a index vector of Grade with ascending
order(Do not use the sort command) and call this function to sort the grades.

Student Grade
1 85
2 70
3 100
4 95
5 80
6 91

You might also like