Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

EXPERIMENT -01

PROGRAM TO PERFORM ALL MARIX OPERATIONS IN MATLAB:

>> a= [1 2 -4;3 5 -1;2 3 -9]; % Creating a 3x3 matrix

>> b= [-5 8 -12;5 6 -5;52 21 -3]; % Creating a 3x3 matrix

>> c= a+b % Addition of two 3x3 matrices

c = -4 10 -16

8 11 -6

54 24 -12

>> d = a-b % Subtraction of two 3x3 matrices

d= 6 -6 8

-2 -1 4

-50 -18 -6

>> e= a*b % Multiplication of two 3x3 matrices

e = -203 -64 -10

-42 33 -58

-463 -155 -12

>> f = det(a) % Determinant of a 3x3 matrix


f = 12

>> g= e' % Transpose of a 3x3 matrix

g = -203 -42 -463

-64 33 -155

-10 -58 -12

>> i= inv(a) % Inverse of 3x3 matrix

i = -3.5000 0.5000 1.5000

2.0833 -0.0833 -0.9167

-0.0833 0.0833 -0.0833


EXPERIMENT -02
PLOT A DISCRETE IMPULSE SIGNAL:

>> t=-2:1:2; %Defining the time constraint

>> y=[zeros(1,2),ones(1,1),zeros(1,2)]; %Defining the amplitude constraint

>> subplot(2,2,1);

>> plot(t,y);

>> stem(t,y),ylabel('Amplitude-->');xlabel('time (n)-->');

1
Amplitude-->

0.5

0
-2 -1 0 1 2
time (n)-->
EXPERIMENT -03
PLOT A DISCRETE UNIT STEP SIGNAL:

>> t=-3:1:3;

>> y=[zeros(1,3),ones(1,4)];

>> plot(t,y);

>> stem(t,y),ylabel('Amplitude-->');xlabel('time (n)');

0.9

0.8

0.7

0.6
Amplitude-->

0.5

0.4

0.3

0.2

0.1

0
-3 -2 -1 0 1 2 3
time (n)
EXPERIMENT -04
PLOT A DISCRETE RAMP FUNCTION

>> t=0:1:5;

>> y=t;

>> subplot(2,2,1);

>> plot(t,y);

>> stem(t,y),ylabel('Amplitude-->');xlabel('time (n)-->');

6
Amplitude-->

0
0 2 4 6
time (n)-->
EXPERIMENT -05
PROGRAM TO CALCULATE CIRCULAR CONVOLUTION:
x=[1,2,3,4]

x= 1 2 3 4

>> y=[1,2]

y= 1 2

>> X=fft(x,4)

X = 10.0000 -2.0000 + 2.0000i -2.0000 -2.0000 - 2.0000i

>> Y=fft(y,4)

Y = 3.0000 1.0000 - 2.0000i -1.0000 1.0000 + 2.0000i

>> H=X.*Y

H = 30.0000 2.0000 + 6.0000i 2.0000 2.0000 - 6.0000

>> circ=ifft(H)
circ = 9 4 7 10

EXPERIMENT -06
PROGRAM TO CALCULATE LINEAR CONVOLUTION

x=[1,2,3,4]

x= 1 2 3 4

>> y=[1,2]

y= 1 2

>> l=length(x)+length(y)-1

l= 5

>> h=conv(x,y)
h= 1 4 7 10 8

EXPERIMENT -07
PROGRAM TO CALCULATE COMBINED CIRCULAR CONVOLUTION

>> x=[1,2,3,4]

x= 1 2 3 4

>> y=[1,2]

y= 1 2

>> l=length(x)+length(y)-1

l= 5

>> y1=[y,zeros(1,3)]

y1 = 1 2 0 0 0
>> x1=[x,zeros(1,1)]

x1 = 1 2 3 4 0

>> X=fft(y1)

X = 3.0000 1.6180 - 1.9021i -0.6180 - 1.1756i -0.6180 + 1.1756i 1.6180 + 1.9021i

>> Y=fft(x1)

Y = 10.0000 -4.0451 - 1.3143i 1.5451 - 2.1266i 1.5451 + 2.1266i -4.0451 + 1.3143i

>> cc=Y.*X

cc = 30.0000 -9.0451 + 5.5676i -3.4549 - 0.5020i -3.4549 + 0.5020i -9.0451 - 5.5676i

>> cc1=ifft(cc)

cc1 = 1 4 7 10 8

EXPERIMENT -08
PROGRAM TO PERFORM CROSS- CORRELATION & AUTO-CORRELATION

>> x=[1,2,3,4]

x= 1 2 3 4

>> y=[1,2]

y= 1 2

>> cc=xcorr(x,y)

cc = -0.0000 0 2.0000 5.0000 8.0000 11.0000 4.0000

>> ac=xcorr(x,x)

ac = 4.0000 11.0000 20.0000 30.0000 20.0000 11.0000 4.0000

>> stem(cc),ylabel(‘ac’);

>> stem(ac),ylabel(‘autoc’);

You might also like