# HHL algorithm, How can I get result from register $|b\rangle$?

From the paper A survey on HHL algorithm: From theory to application in quantum machine learning , I use qasm code from here. I try to follow the example in page 7. with Ax = b and  From the algorithm 2 in page 7 from the paper, They applied measurement on qubit q.
If q = $$|1\rangle$$, the answer will be stored in q[.3] or register b. But in the example here, I got state $$|0\rangle$$ from ancilla bit if I use the same rotation angle as the example.

When I measure register b, I always got state $$|1\rangle$$ even if the result on ancilla bit is $$|1\rangle$$ (I change ancilla bit rotation angel from the example to 3.6591 and 1.8296).

Does the problem is the rotation angle on ancilla bit?
How can I get the correct result on register b? Can you give me a good example to do this?

In your code the measure clause means one shot, so the state collapses to one basis state as here: By removing that last line the Statevector option shows the state before measurement, i.e. as a superposition of basis states: Now you can see that for the basis states with q=1 (that is 0001 and 1001) we get the right components of the solution vector $$x$$ (you can check that the numbers coincide with those reported in Table 2, row 1 of the paper you mentioned).
The "right" thing to do here if you want to avoid statevectors would be to do a few measurements and calculate the probabilities of obtaining 0001 and 1001, which is what they explain in Section 3.3.2. of the paper. The more measurements you do, the closer the probabilities you calculate will be to those from the statevector simulation.