You are on page 1of 3

ENG1060 Computing for Engineers

Faculty of Engineering
Semester 2 - 2012
ENG1060 Computing for Engineers

LABORATORY 1

This laboratory comprises 2% of your final grade. You will be assessed


during your laboratory session by the demonstrators. You will be assessed
on the quality of your programming style as well as the results produced by
your programs. Save your work in M-Files called lab1t1.m, lab2t2.m etc.

This laboratory will introduce you to MATLAB and cover variables and
basic calculations.

Note: Some of the functions presented would be new to you and you
should use the MATLAB HELP to learn them and how to use them.

Task 1 (1 mark)
Use MATLAB as a calculator to complete the following in an M-file.

Use the following values for the variables x and y; x = 10, y = 3.

NOTE : Typing help elfun into the command window will provide you a
listing of the elementary mathematical functions available. Alternatively
press F1 to launch the MATLAB help tool.

1. u = x + y
xy
2. v =
4
y
3. w = x sin
2
4. n = mod( x, y ) (What does the command mod do?)
5. z = linspace( y, x,15) (What does the command linspace do?)

MATLAB Laboratory 1 Page 1 of 3


ENG1060 Computing for Engineers


6. a = u cos 2 3 y
4
7. c = y2 x
1
1
8. d = 1
x
2
9. e = 1 + c [Hint: Absolute value or magnitude]

Task 2 (1 mark)
L
The period T of an oscillating pendulum is given as: T = 2 where L is the
g
length of the pendulum, and g is the acceleration due to gravity. Using MATLAB,
calculate the period of a 200mm long pendulum. (Use g = 9.81 ms-2)

Hint: Be careful with units

Task 3 (1 mark)
The knot is a unit of speed equal to 1 nautical mile (0.514 m/s). Write a MATLAB
program that converts 15 knots to km/hr.

Note: First you need to convert m/s to km/hr

Task 4 (1 mark)
The potential energy of an object due to its height above the surface of the Earth
is given by the equation
PE = mgh
where m is the mass of the object, g is the acceleration due to gravity, and h is
the height above the surface of the Earth. The kinetic energy of a moving object
is given by the equation
1
KE = mv 2
2
where m is the mass of the object and v is the velocity of the object. Consider a
5kg big fat cat falling from the roof.

Use MATLAB to calculate the total energy (potential energy plus kinetic energy)
possessed by this cat in the earths gravitational field when it is experiencing
velocity of 1.5 ms-1 at 300mm above ground.

MATLAB Laboratory 1 Page 2 of 3


ENG1060 Computing for Engineers

Task 5 (1 mark)
The distance between two points (x1, y1) and (x2, y2) on a Cartesian coordinate
2 2
plane is given by the equation d = ( x1 x2 ) + ( y1 y2 ) . Calculate the distance
between the points (2,3) and (8,-5) using MATLAB.

Task 6 (1 mark)
The capacitance of two parallel conductors of length L and radius r, separated by
L
a distance d in air, is given by C =
d r
ln
r
where is the permittivity of air = 8.854 10-12 F/m. Using MATLAB, calculate
the capacitance C given that L = 1m, r = 1mm, and d = 4mm.

Task 7 (2 marks)
The equivalent resistance Req of four resistors R1, R2, R3 and R4 connected in
series is given as

Req = R1 + R2 + R3 + R4

The equivalent resistance Req of four resistors R1, R2, R3 and R4 connected in
parallel is given as
1
Req =
1 1 1 1
+ + +
R1 R2 R3 R4
Use MATLAB to calculate the equivalent resistance of four resistors (270,
1.2k, 890 and 740)

(i) if they are connected in series


(ii) if they are connected in parallel

Task 8 (2 marks)
A commercial airplane has an average take off speed of 297 Knots, cruising
speed of 454 Knots and landing speed of 135 Knots. Assuming the plane starts
cruising after 50km into the journey and stops cruising 50km before reaching its
destination, use MATLAB to calculate how long (hours and minutes) it takes the
airplane to travel from Melbourne to Sydney (917km journey).

Note: You can reuse your program from Task 3 to convert knots to km/hr.

MATLAB Laboratory 1 Page 3 of 3

You might also like