Student Id:202015005 Date:23-Mar-21 Name: Anand Therattil
Student Id:202015005 Date:23-Mar-21 Name: Anand Therattil
clear, clc;
T=1.6; ND=1000; nn=0:ND; ts=0.002; tt=nn*ts; % Time interval
Ts = 0.1; M = round(Ts/ts); % Sampling period in continuous/discrete-time
nns = [1:M:ND+1]; tts = (nns-1)*ts; % Sampling indices and times
ks = [1:4 3.9 4]; tds = [0 0 0.1 0.1 0 0.15]; % Frequencies and delays
K = length(ks);
for i=1:K
k=ks(i); td=tds(i); x(i,:) = exp(j*2*pi*k*(tt-td)/T);
if i==K, x(K,:) = [x(K,[302:end]) x(K-3,[1:301])]; end
subplot(K,2,2*i-1), plot(tt,real(x(i,:))),
hold on, plot(tt([1 end]),[0 0],"k"), stem(tts,real(x(i,nns)),'.')
end
N = round(T/Ts); xn = x(:,nns(1:N));
xn*xn'/N % check orthogonality
Xk = fft(xn.').'; kk = 0:N-1;
for i=1:K,
k=ks(i); td=tds(i); subplot(K,2,2*i), stem(kk,abs(Xk(i,:)),'.');
end
2. Study circular convolution of two discrete N length sequences and the discrete Fourier
transform of the product. Write a MATLAB code to implement circular convolution
through the linear convolution. In order to do so, circularly augment one of the
sequences. This exercise will elucidate the concept of cyclic prefix used in OFDM
system.
clc;clear;
n = -2:0.01:2;
x1 = sinc(n*pi);
x2 = sinc(2*n*pi);
X1 = fft(x1);
X2 = fft(x2);
x1pad = x1;
x2pad = [x2,zeros(1,length(x1)-length(x2))];
C = ifft(fft(x1pad).*fft(x2pad));
C_1 =conv(x1,x2);
plot(x1);hold on;grid on;
plot(x2);
xlabel("Time");
ylabel("Amplitude");
legend("Signal 1","Signal 2");
hold off;
figure(2);
plot(C,"b");hold on;
plot(C_1,"r.");
grid on;
hold off;
legend("IFFT","Convolution");
Inference:
The orthogonality between the signals is observed through the inner product. The
Matrix is the observed where the first 4 signal are orthogonal l and then the rest of the
signals are not orthogonal as there is discontinuity in the signal x5 and x6. Linear
convolution “convolves” two independent signals and comes up with a signal, the
length of which is different from the length of the two input signals. The Conversion of
the Circular Convolution to Linear Convolution is done by padding of the zeros to the
signal as the Circular Convolution is for periodic signals.