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.
- A = ones(5,1);
- B = -ones(5,1);
- C= [A,B];
- if (A<0)
- disp('Hi, I am broken')
- end
- if (B<0)
- disp('Hi, I am working but not really well defined')
- end
- if (C<0)
- disp('Hi, I am ignoring certain values')
- end
Comments
Post a Comment