Docsity

Practice Exercise for Final Exam - Computing for Engineers | ENGR 1731, Exams of Engineering

Toggle sidebar
bg1
ENGR 1731 C Computing for Engineers
Practice Exercise for Final Exam Spring 2009
1.- Assume that A, B, and w are defined as follows, calculate the results of the following operations if
they are legal, if an operation is not legal, explain why it is illegal.
A = [ 3 1 ; 2 0 ; 6 5 ]; B = [ 3 ; 2 ; 1 ]; w = 0.5
a) A .* B
b) A * B
c) B * A
d) A' * B
e) B' * B
f) B*B'
g) B * A′
h) A* A′
i) A′ * A
2.- Assume that x and y, are defined as follows, calculate the results of the following operations if they
are legal, if an operation is not legal, explain why it is illegal.
x = [ 3 6 ]; y = [ 3 ; 2 ; 2 ];
a) x * y
b) y * x
c) y * y
d) y * y′
e) y′ * y
f) x′ * y′
g) y′ * x′
h) x′ * y
i) y * x′
2.- Consider the following Matlab script, what is the result of running the code ?
A = [ [1 2 3]' [3 2 1]' [2 1 3]'];
B = eye(size(A));
for j = 2:3
for i = j:3
B(i,:) = A(j-1,:)*A(i,j-1);
end
end
display(B)
pf3

Partial preview of the text

Download Practice Exercise for Final Exam - Computing for Engineers | ENGR 1731 and more Exams Engineering in PDF only on Docsity!

ENGR 1731 C Computing for Engineers Practice Exercise for Final Exam Spring 2009

1.- Assume that A, B , and w are defined as follows, calculate the results of the following operations if they are legal, if an operation is not legal, explain why it is illegal.

A = [ 3 1 ; 2 0 ; 6 5 ]; B = [ 3 ; 2 ; 1 ]; w = 0.

a) A. * B b)^ A * B^ c)^ B * A

d) A' * B e) B' * B f) B*B'

g) B * A′ h) A* A′ i) A′ * A

2.- Assume that x and y , are defined as follows, calculate the results of the following operations if they are legal, if an operation is not legal, explain why it is illegal.

x = [ 3 6 ]; y = [ 3 ; 2 ; 2 ];

a) x * y b) y * x c) y * y

d) y * y′ e) y′ * y f) x′ * y′

g) y′ * x′ h) x′ * y i) y * x′

2.- Consider the following Matlab script, what is the result of running the code?

A = [ [1 2 3]' [3 2 1]' [2 1 3]'];

B = eye(size(A));

for j = 2:

for i = j: B(i,:) = A(j-1,:)*A(i,j-1); end

end

display(B)

3.- Two equal size spheres are placed in a rectangular prism, as shown in the figure below. Consider the

spheres have radius r , and the dimensions of the rectangular prism are d and h. Assume that d = 2r as

shown in the figure.

Write a MATLAB function that will determine the volume of the available “ free space” within the rectangular prism. Name your function FreeSpace. The input variables are r and h and the output variable is freevol.

The volume of a sphere is: (4/3) π r 3 and the volume of the rectangular prism is: h d 2

4.- Write a Matlab program that will solve the following problem: The admission fee at a small fair is $1.50 for children and $4.00 for adults. On a certain day, 2200 people enter the fair and $5050 is collected. How many children and how many adults attended? Notice that a system of equations will help to solve this problem.

5.- Assume you want to choose the best cell phone plan. Assume there are two phone companies that offer the following rates.

  • No-dead-zones charges 50 ¢ for the first minute plus 5¢ for each extra minute
  • Signal-Always charges $ 1.00 for the first minute plus 3¢ for each extra minute.

Write a Matlab Program that will answer the following questions a) At how many minutes do both companies charge the same amount? b) When is No-dead-zones a better Value? c) When is Signal-Always a better Value?

Notice that a system of equations will help to solve this problem.

6.- Write a MATLAB function that receives a vector t as an input, and returns a vector x as an output

from the following equation. Name your function sillyFunc.

⎪⎪^ (^ )

9 sin 5 50 31 4 6. 5

t t

t t

t t

x

Then, write a Matlab main program to plot y vs. x , where y is defined as

y = Cos( x ) ( x^3 ) (Sin 2 x )