You are on page 1of 2

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment-3.1

Student Name: Akansha UID: 21BCS10245


Branch: CSE Section/Group: SC-906-A
Semester: 6th Date:27-03-24
Subject Name: Soft Computing LAB Subject Code: 21CSP-377

1. Aim: To store vector in an auto-associative net. Find weight matrix & test the net withinput.

2. Objective:. Auto-associative neural net to store the vector.


3. Algorithm:
1. Initialize x as [1 1 -1 -1] and create a zero matrix w of size 4x4.
2. Compute w as the outer product of x with itself.
3. Compute yin as the inner product of x with w.
4. Initialize an empty vector y.
5. For each element i in yin:
a. If yin(i) is greater than 0, set y(i) to 1.
b. Else, set y(i) to -1.
6. Display the weight matrix w.
7. If x is equal to y, display "The vector is a Known Vector".
8. Else, display "The vector is an Unknown Vector".

4. Script and output:

x = [1 1 -1 -1];
w = zeros(4, 4);
w = x' * x;
yin = x * w;
y = zeros(1, 4);
for i = 1:4
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
if yin(i) > 0
y(i) = 1;
else
y(i) = -1;
end
end
disp('Akansha 21BCS10245');

disp('Weight matrix:');

disp(w);

if isequal(x, y)

disp('The vector is a Known Vector');

else

disp('The vector is an Unknown Vector');

end

5. OUTPUT

You might also like