You are on page 1of 4

ANSWERS

Question 1
PROGRAM
clc;
A=[2 7 9 7;3 1 5 6;8 1 2 5]
a=A'%transpose of A
b=A (:,[1 4])% displays elements of 1st and 4th column of matrix A
c=A([2 3],[3 1])%displays 3rd and 1st colum of 2nd and 3rd row respectively
d=A(:)%displays the entire matrix columnwise
e=A(end,:)%displays last row of the matrix
f=A(1:3,:)%displays the current matrix
g=[A;A(1:2,:)]%displays current matrix and 1 st and 2nd row of matrix
RESULT
A =
2 7 9 7
3 1 5 6
8 1 2 5
a =
2 3 8
7 1 1
9 5 2
7 6 5
b =
2 7
3 6
8 5
c =
5 3
2 8
d =
2
3
8
7
1
1
9
5
2
7
6
5
e =
8 1 2 5
f =
2 7 9 7
3 1 5 6
8 1 2 5
g =
2 7 9 7
3 1 5 6
8 1 2 5
2 7 9 7
3 1 5 6

Question 2
PROGRAM
close all;clear all;clc;
x=0:0.2:4
y1=x
y2=x.*x.*x
y3=exp(x.*x)

subplot(3,3,1)
plot(x,y1,'r')
title('rectangular plot')
subplot(3,3,2)
plot(x,y2)
subplot(3,3,3)
plot(x,y3)


subplot(3,3,4)
semilogx(x,y1,'r')
title('semilog plot')
subplot(3,3,5)
semilogx(x,y2)
subplot(3,3,6)
semilogx(x,y3)


subplot(3,3,7)
loglog(x,y1,'r')
title('logarithmic plot')
subplot(3,3,8)
loglog(x,y2)
subplot(3,3,9)
loglog(x,y3)






RESULT

Question 3
PROGRAM
n=[1 2]%coefficent of numerator polynomial
d=[2 3 4]%coefficent of denominator polynomial
sys=tf(n,d)%transfer function of the system

RESULT
n =
1 2
d =
2 3 4
Transfer function:
s + 2
---------------
2 s^2 + 3 s + 4

You might also like