MatLab - Can not detect all lines in a "simple" image using houghlines
houghpeaks function in MATLAB accepts a parameter named NHoodSize that specifies the size of the neighborhood where a non-maximum suppression (NMS) is carried out. In simple terms, NMS removes all duplicate peaks which lie in a certain window. This is what explains your double-lines with a single line. If you set the window size lower, such as $[7,7]$, you will see that it will start detecting them. For instance, modify the call as:


  P=houghpeaks(H,20,'threshold',ceil(0.3*max(H(:))), 'NHoodSize',[7 7]);


You will then see the following result:


You should play with those parameters till you find your ideal setting: Not many lines, and correct ones not missed.