You are on page 1of 3

1 | P a g e

Part A:

Q1.
(
(
(
(
(
(

=
x x
x x
x x
x x
x x x x x
A
1 1 1 5
1 1 1 4
1 1 1 3
1 1 1 2
5 4 3 2
2
2
2
, where x is last digit of your student index number without
alphabets or characters (Example x=5). Calculate the followings:
(a)
1 )
and ) ( t Determinan , (

+ A A A A A
T

(b)
|
|
.
|

\
|
+
+
A A
A A
2 1
1


Q2. Solve the system of equations 0 = + b AX for ) 5 ,.., 1 ( = i z
i
, where
= X
|
|
|
|
|
|
.
|

\
|
=
|
|
|
|
|
|
.
|

\
|
1
1
1
1
1
,
5
4
3
2
1
b
z
z
z
z
z


Q3. (a) Determine the value of Y:

H H H H H Y + + + + +
|
|
|
|
|
|
.
|

\
|
=
2 3 4 5
1 0 0 0 0
2 1 0 0 0
2 2 1 0 0
2 2 2 1 0
2 2 2 2 1


(b) What are the outputs on the Matlab command prompt of the followings, after
running Q3 (a) ? (i) Y(5,4) (ii) Y(8,9)






Department of Electrical Engineering
University of Moratuwa,
Sri Lanka

Computer Aided Design and Simulation (EE4073)
Assignment 1(MatLab Basics)

2 | P a g e

Part B:

Q4.Following MATLAB codes (C4) will produce a 3D graph as shown in Figure Q4. Explain
all the coding instructions (C4) in your own words.


k=5;
n=2^k -1;
theta=pi*(-n:2:n)/n;
phi=(pi/2)*(-n:2:n)/n;
X=[cos(phi)]'*[cos(theta)];
Y=[cos(phi)]'*[sin(theta)];
Z=[sin(phi)]'*ones(size(theta));
colormap([0 0 0;1 1 1]);
C=hadamard(2^k);
surf(X,Y,Z,C);
axis square;




C4



Figure Q4

Q5. Plot the curve using polar(sin(x),cos(x),'r'), where x represents the following vector. Title
the graph with your name and index number.
| |
T
t x ... 4 . 1 8 . 0 0 =

Q6. What is the output of the following program and explain the functional outcomes of the steps.
th=(0:127)/128*2*pi;
x=cos(th);y=sin(th);
f=abs(fft(ones(5,1),128));
stem3(x,y,f','d','fill');
view([-65 30])


Q7. Find all the possible solutions to the following equation using a computer aided graphical method.


0 sin
2 3
= + + A x x Ax


where A is your student index number (take only last two digits).



Part C:

Q8. Evaluate the value of the following integration


( ) ( )dx x x
}


5 . 2
5 . 2
2 2
exp 10 cos

How will you improve the accuracy, if you use any numerical computation?
3 | P a g e

Q9. Write a program to create a data file to plot f(x), where


( ) ( )
2 2
exp 10 cos ) ( x x x f =


The file name should reflect your name/index number and the format should be as follows:
(Data range: From x= -5 to x= +5, you may select a desired sampling interval)

Using the above created data file, plot f (x), taking the range from x = -3 to x = +3


Q10. Plot the 3D graph of Rastrigin's function ( )
2 1
, x x f , having few local Maxima and local
Minima values such that

( ) ( )
1 1
1 1
2 cos 2 cos 10 20 ,
2
1
2 1
2
2
2
1 2 1
s s
s s
+ + + + =
x
x
x x x x x x f t t

Find the global minima of ( )
2 1
, x x f and corresponding( )
2 1
, x x values. (Hint: You may
generate two random numbers at a time and find the value ( )
2 1
, x x f . Compare that value with
the previous value obtained in similar manner and make a logical decision to get a more
accurate value. Repeat this for a large population and get the optimum)

Q11. What is the output of the following program and explain the functional outcomes of the
steps.
r = zeros(1,32);
for n = 3:32
r(n) = rank(magic(n));
end
bar(r);


Submission

You should submit the hardcopy to the department office on or before the deadline.
Deadline: 02 July 2014

Dr. A.G.B.P. Jayasekara
Department of Electrical Engineering
1 xx xx
2 xx xx
3 .. ..
Index x value f(x) value
1 xx xx
2 xx xx
3 .. ..
Index x value f(x) value

You might also like