0% found this document useful (0 votes)
7 views

DC LAB ASS (1)

Uploaded by

kalyani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

DC LAB ASS (1)

Uploaded by

kalyani
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Name: KANIMOZHI HARSHINI.

M
Date: 27/11/2024
Roll No: AM.EN.U4ECE22157

Amrita Vishwa Vidyapeetham


Amritapuri Campus
19ECE382 COMMUNICATION SYSTEMS LAB
LAB SHEET 6
GRAM-SCHMIDT ORTHOGONALIZATION
ASSIGNMENT

Lab Exercises:-
1. Use Mat lab to find and plot the orthogonal basis for the waveforms
of the Signal Set
2. Find the coordinates and plot these signals as points in signal space.

MATLAB CODE:

% KANIMOZHI HARSHINI.M
% AM.EN.U4ECE22157

close all clear


all
clc
% Time t1 =
0:0.01:1; t2 =
1.01:0.01:2; t3 =
2.01:0.01:3; t =
[t1 t2 t3];
dt = 0.01;

% Signals s1 = [ones(1, length(t1)) ones(1, length(t2)) zeros(1,


length(t3))];
s2 = [ones(1, length(t1)) -1*ones(1, length(t2)) zeros(1, length(t3))];
s3 = [-1*ones(1, length(t1)) ones(1, length(t2)) ones(1, length(t3))];
s4 = [ones(1, length(t1)) ones(1, length(t2)) ones(1, length(t3))];

% Plotting signals figure;


subplot(2, 2, 1); plot(t,
s1); xlabel('Time(s)');
ylabel("s1(t)");
title('Signal Set 1');

subplot(2, 2, 2); plot(t,


s2);
xlabel('Time(s)');
ylabel("s2(t)");
title('Signal Set 2’);

subplot(2, 2, 3); plot(t,


s3);
xlabel('Time(s)');
ylabel("s3(t)");
title('Signal Set 3');

subplot(2, 2, 4);
plot(t, s4);
xlabel('Time(s)');
ylabel("s4(t)");
title('Signal Set 4');

% basis functions figure;


E_s1 = sum(s1 .* s1) * dt; psi1 = s1 / sqrt(E_s1);
subplot(2,2,1); plot(t, psi1);
title("Basis function 1"); xlabel("Time(s)"); ylabel("psi1");
c21 = sum(s2 .* psi1) * dt; d2 = s2 - c21 * psi1;
E_d2 = sum(d2 .* d2) * dt; psi2 = d2 / sqrt(E_d2);
subplot(2,2,2); plot(t, psi2);
title("Basis function 2"); xlabel("Time(s)"); ylabel("psi2");

c31 = sum(s3 .*psi1) * dt; c32


= sum(s3 .* psi2) * dt;
d3 = s3 - (c31 * psi1 + c32 * psi2); E_d3 = sum(d3 .* d3) * dt;
psi3 = d3 / sqrt(E_d3); subplot(2,2,3); plot(t, psi3);
title("Basis function 3"); xlabel("Time(s)"); ylabel("psi3");

% Verifying orthogonality and decomposition


c41 = sum(s4 .* psi1) * dt; c42 = sum(s4 .* psi2) * dt;
c43 = sum(s4 .* psi3) * dt; d4 = round(s4 - (c41 *
psi1 + c42 * psi2 + c43 * psi3))

%basis coefficients for all signals


S1 = [sum(s1 .* psi1) * dt, sum(s1 .* psi2) * dt, sum(s1 .* psi3) * dt];
S2 = [sum(s2 .* psi1) * dt, sum(s2 .* psi2) * dt, sum(s2 .* psi3) * dt];
S3 = [sum(s3 .* psi1) * dt, sum(s3 .* psi2) * dt, sum(s3 .* psi3) * dt];
S4 = [sum(s4 .* psi1) * dt, sum(s4 .* psi2) * dt, sum(s4 .* psi3) * dt];

% Results
disp("Coefficient for s1:"); disp(S1);
disp("Coefficients for s2:"); disp(S2);
disp("Coefficients for s3:"); disp(S3);
disp("Coefficients for s4:"); disp(S4);

Output:

Coefficients for s1:


1.4177 0.0000 0.0000
Coefficients for s2:
0.0071 1.4177 0.0000
Coefficients for s3: -
0.0071 -1.4177 1.0000
Coefficients for s4:
1.4177 0.0000 1.0000
Plots:

You might also like