Task 1
Complex Numbers in matlab
%Lab 5 Task 1 close all clear clc j=sqrt(-1); x=5+3j; y=6-2j; z=x+2*y; %Decomposing the real and imaginary part of a complex number disp(real(z)); disp(imag(z)); %Finding polar form of a complex number.\ disp(abs(z)); disp(angle(z));
Task 2
Real and Imaginary Components of complex numbers.
%Lab 5 Task 2 close all clear clc j=sqrt(-1); theta=-2*pi:0.1:2*pi; x=exp(j*theta); figure plot(theta,real(x)) xlabel('theta') ylabel('Real part of e^i ^t^h^e^t^a') figure plot(theta,imag(x)) xlabel('theta') ylabel('Imaginary part of e^i ^t^h^e^t^a')
Task 3
Convolution Using Built-in function
%Lab 5 Task 2 close all clear clc h=[0 0 1 1 1 0 0]; x=[0 0 0.5 2 0 0 0 ]; y=conv(x,h); figure subplot 311 stem(x) ylabel('x') subplot 312 stem(h) ylabel('h') subplot 313 stem(y) ylabel('x*h')
Task 4
Convolution without built-in function
To be done by students
Task 5
Fourier series: Lathi Example 3.3
To be done by students
Task 6
Fourier Series of a square pulse
To be done by students