You are on page 1of 2

Computer Fundamentals

Name:

Kamran Ali Ahmed

Time:

15 minutes

Class:

2009- Mechanical
Engineering

Date:

27th May, 2010

2009-ME-383

Marks:

30

Roll
Num
ber:

Instructions
There wont be any credit for over-writing or cutting the answers. Staring at
others papers could result in cancellation of your quiz.
Question 1:

Use colon notation to construct the following vectors.


a. 0, 2, 6, 4, 8, 10,, 100.
b. 900, 801, 702, , 9.

2 marks

a.>>
b.>>

Question 2:

How would the following vectors look like?


4 marks

a. x = [ 0:(2^2)^2:50]
b. y = [ 4: 4+4-4+2-1-4:10]
a.>>
b.>>

Question 3:

For the following statements, TICK either YES or No to answer


whether they are correct syntax-wise or not.//Hint: Dimensions for array questions
6 marks
a. y =

YES
b. x =
c. z =

NO

eye(3).*ones(2)
zeros(2,3) * ones(3,2)
linspace(1,1,1)

Question 4:

Given the array A = [2 7 9 7 ; 3 1 5 6 ; 8 1 2 5], explain/give the results of


thefollowing commands:
10 marks
a. A

Computer Fundamentals

b. A(:, [1 4])

c. A([2 3],[3 1])

d. [A A]

e. [A; A]

Question 5:

Draw the plots for the following programs.% just show what kind of shape

would it be.
8 marks
a. x = [ -10:10 ]
y = x.*x;
plot (x,y);

b. y = [ -10:10 ]
x = y.*y;
plot (x,y);

Figure a

Figure b

You might also like