# CSE 432 Spring 2019 Lab 5

February 24, 2019

Complex numbers in matlab. Complex number mathematics (Addition Subtraction) in Matlab.

```%Lab 5
close all
clear
clc
j=sqrt(-1);
a=5;
b=6;
c=a+j*b;
d=3+j*9;

x=5*c+6*d;

disp(real(x));
disp(imag(x));
disp(abs(x));
disp(angle(x));```

Sin and cosine component of a complex numbers.

```%Lab 5
close all
clear
clc
j=sqrt(-1);

f=1;
w=2*pi*f;
fs=100;
t=0:1/fs:5;
y=exp(j*w*t);
figure
plot(t,real(y));
title('real Part of complex exponential variable e^j^w^t');
xlabel('t');
ylabel('Real(e^j^w^t)');
figure;
plot(t,imag(y));
title('imaginary Part of complex exponential variable e^j^w^t');
xlabel('t');
ylabel('Imaginary(e^j^w^t)');```

Convolution using built-in function.

```%Lab 5
close all
clear
clc
x=[0 0 1 1 1 0 0];
h=[0 0 0.5 2 0 0 0];
n=[-2:4];

y=conv(x,h);
figure
subplot 311
stem(x)
subplot 312
stem(h)
subplot 313
stem(y);```

Convolution without built-in function.

`To be done by students`

Fourier Series.
Lathi Example 3.3

`To be done by students`

`To be done by students`