Sunteți pe pagina 1din 7

EE4073

Lab1 Assignment
Part A
Q1)

a. X=-3: .05:3;
Y=-3:.05:3;
These rows defined the range of x and y axis where we need to plot the
graph.
[X,Y]=meshgrid (x,y);
Z=-X.*X - 2.0.*Y.*Y+cos(3.0.*pi.*X)+03*cos(4.0.*pi.*Y)+4;
Z is defined as the function of X and Y.
contourf(X,Y,Z);
surfc(X,Y,Z);

X label (x1);
Y label (X2);
Z label (function value)
These 3 rows are defined the name of x ,y and z axis as x1,x2 and function
value respectively.

Grid on
This is indicate to on the grid around the graph.

b.
Q2)

r= zeros(1,32);

for n = 3:32 %loop for from 3 to 32

r(n)=rank(magic(n));

end % loop end

bar(r); %bar type graph


Q3) polynomial A
s=linspace(-5,5,100); %range of graph have to plot
coeff=[1 3 3 1]; %coefficient of equation S3+3S2+3S+1
A=polyval(coeff,s);
plot(s,A);
xlabel('s'); % name of X axis is s
ylabel('A(s)'); % name of y axis is A(s)
roots(coeff);%roots of above eqwuation

Part B

Q4)

Output1
Output2

Output3
Q5)