This is one of those questions that tend to languish unanswered on the site. Why? Because you just say that your code does not work, does not produce the correct results. So we see a complicated code, lacking much in the way of comments about what you did. Worse, those comments seem to make little sense. For example, I see:
Alfa_i(t) = Alfa_i(t) + 1/(abs(H_dk(t2,:)*W(:,t2)));
Alfa_i(t) = Alfa_i(t) - Alfa_k(t);
There is clearly a sum happening in there, but exctly what is being summed is not Alpha_i. At best, Alpha_i is the result of a sum.
And that was one of the only comments in your entire code. Oh. One other, where you tell the reader the completely obvious:
I could compare your code to one I was given to maintian. In some 300 lines of code, there was only one comment. In a code block, where a matrix called C was clearly constructed, the ONLY comment was: "Create C matrix here". There was no information offered as to what C meant, or what will be done with it. Your code is almost analogous. And you want us to read that code and debug it, knowing only that it possibly does not work properly for some ungiven reason?
Then we must guess what it does wrong. Yes, it is supposed to follow the given pseudo-code. But then we must dive deeply into code written by you, to figure out where the problem is, when nobody has even said what it does wrong. And that is going to take some serious luck, for someone to wander by who has many hours to waste for probably no success.
If you want help, then I would first explain CLEARLY what answer you think it should produce. Then explain what it does produce, and why you think it is a problem. Remember, that if you go to a doctor and tell them only that your leg does not hurt, will they be able to know what is the reason you went to see them, and perhaps how to help you?
Better yet is to help yourself. Extract this code from what contains it. Use the code, by providing a simple, sample problem where you will know the answer that JUST this code fragment should perform correctly. Does it work? If not, then you can lean why. This, by the way, is why modular code is valuable. You can test every piece. NEVER throw together a huge mess of code and expect it all to work the first time. Write code in SMALL fragment. Test EVERY such code fragment. Only when they all work as you know they should do you build the larger code.
Next, learn to use the debugger! Trace through the code. Verify every line of code. Does it do what you expect it to do on the sample subproblem I suggested you formulate?
So I'm sorry that this is not really an answer, because I think no answer is really possible. You are the best person to solve this problem. You have the most incentive to want to solve it, to spend what may be a few hours tracking down the problem. I recall a saying from my misspent youth: "God helps those who help themselves." At the very least, make it possible for someone to help you. Good luck.