File Exchange

image thumbnail

Hebbian Learning

version (17.4 KB) by Bhartendu
Hebbian Learning rule, (Artificial Neural Networks)


Updated 21 May 2017

View License

When comparing with the network output with desired output, if there is error the weight vector w(k) associated with the ith processing unit at the time instant k is corrected (adjusted) as
w(k+1) = w(k) + D[w(k)]
where, D[w(k)] is the change in the weight vector and will be explicitly given for various learning rules.
Hebbian Learning rule is given by
w(k+1) = w(k) + eta*y(k)*x(k)

Cite As

Bhartendu (2021). Hebbian Learning (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)

Rupa Lakshmi

özden niyaz

özden niyaz

Dear Bhartendu,

Unfourtunately your code is broken.

First of all the if statement is wrong as itr> maxItr, should've been reverse as itr< maxItr. Initial values are itr=0; maxItr=1000; while loop doesn't working cause 0 is not greater then 1000 as everyone knows.
Secondly the other if statement is wrong also. It's written as i=1:size(xtrain,2) according to your example i counts from 1 to 4. But next statement is net=w'*xtrain(i,:); despite of xtrain sizes are 3x4. There isn't xtrain(4,:).

But you never get an error because it never breaks into while loop and for loop also, and calculates all the d values according to your initial weights.

Thanks everyone who never mentioned about this errors for three years :)


sagar kumar dash

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!