How can I implement this algorithm using Matlab?

In the future this type of question is way more appropriate for Stack Overflow.
But i see two potential problems. But I will admit that I don’t know the algorithm
First is that the inner for loop does nothing besides calculate the j=4 option and store it. If you want the sum of those values you need to do that properly.
Second, Your comparison operator for deltaE looks at all DeltaEs not the most recent one. This is probably what is really causing your problem. Try running the clode below for a simple explaination.
  1. A = ones(5,1);
  2. B = -ones(5,1);
  3. C= [A,B];
  4.  
  5. if (A<0)
  6. disp('Hi, I am broken')
  7. end
  8.  
  9. if (B<0)
  10. disp('Hi, I am working but not really well defined')
  11. end
  12.  
  13. if (C<0)
  14. disp('Hi, I am ignoring certain values')
  15. end

Comments

Popular posts from this blog

What are applications of MATLAB?

How can I learn genetic algorithm using MATLAB (to be precise).

What are some good dissertation tips?