You are on page 1of 2

# H82FPC

Spring 2013-14

Session 1 Examples
1. Compute

a) 8/10

b) 5*(8/10)

c) 1.04 + 4.15 - 5.078*87

2. Assign the following variables: p = 7.1, x = 4.92, k = -1.7 and evaluate

 1 
t =

 1 + px 
3. Compute

a) cos(π/3)

4. Compute

a) 4/5 + 3/2
b) 0.365 – 149 + (25-6.3)/10
c) sum of a) and b)
d) square root of c)

k

b) square root of 17

c) ln(5)

5. Evaluate the following at x = 0.1 and a = 0.5

y=

e( −π x ) − sin( x ) / cosh(a ) − ln e ( x + a)

6. Write a script to perform the following calculations and save as Ques6.m.

2
10 

A = [1 2 3 4 5]; B = [2 4 6 8 10]; C = 20 ; D =
3.5  ;
 

30 
sin(π / 2) 
16 5 
 0.1 0.4 
E=
; F =

;
 7 2
0.3 0.8
Y = A+ B

X =C−D

P = 3.* A

Q = sqrt (C )

R = sin( D)

Z1 = E.* F

Z2 = E*F

Z 3 = A./ B

7. Determine the roots of
a)
b)
c)
d)

4x2 + 3x = 25
x4 + 3x2 = 10
x3 – 7x2 + 40x – 34 = 0
290 – 11x + 6x2 + x3 = 0

8. Solve the following sets of equations:
a) 6x + 12y + 4z = 70
7x - 2y + 3z = 5
2x + 8y – 9z = 64

Page 1

Z 4 = A. ^ 2

5 3x + 5y + 7z = 4 4x + 9y + 2z = 12 9.H82FPC Spring 2013-14 b) 6x .503774 Page 2 .3y + 7z = 75 14x + 9y – 5z = -67 c) 8x + y + 6z = 7. Write a script M-file that converts a user input pressure in psi to bar and displays the result. Write a script M-file that converts a user input temperature in Fahrenheit to Celsius and displays the result.4y + 8z = 112 -5x . Temperature in Celsius = 5/9*(Temperature in Fahrenheit – 32) 10. Pressure in bar = Pressure in psi/14. Check your script with the following data: [72 68 75 77 83 79].