Forget about my previous post on this thread.
Not only is it too much work -- it's just wrong. It'll never come out with the right answer since your curve is not decreasing exponentially.
If Ui is the given initial (potential) energy, with CONSTANT friction opposing the motion, your velocity (x') has to go to 0 (and STAY at 0) within some finite number of oscillations. It's just a matter of time until fk*(dist. traveled) = Ui. Right?
Also, you CAN'T represent the friction force as b*dx/dt, because ordinary friction between a block and a surface is not a function of velocity. (Unless you're talking about air resistance, or fluid resistance, which usually are treated as a function of velocity.) In that case, this solution is no good and you should just solve the basic differential equation and graph the result. Or just use the formula that schwarzchildradius posted. But it was interesting to think about this anyway.
If we're actually talking about ordinary friction, I think you have to define the function piecewise.
Assuming you start at t=0, x=xmax, x' = 0
and coeff. of kinetic friction is μ
and coeff. of static friction is also μ (usually greater than kinetic friction, but you only mentioned one μ, so maybe you want to simplify it & treat them as the same. Otherwise, adjust the solution accordingly.
You are given the initial energy, so using U = (1/2)kx2 solve for x and that gives you the initial displacement xmax
Then, solve the diff. equation:
mx" + kx = μm
letting ω = √(k/m)
and using the initial conditions, at t=0, x(0)=xmax, x'(0) = 0
(You do the math based on your actual numbers.)
Then solve your equation for x and t when x'=0 (which is the next time that the block comes to a stop, after 1/2 cycle); call them x1 and t1.
This let's you calculate the spring force at that time using f = -kx1. The block will resume moving only if that force is greater in magnitude than μm. (If you want to be more precise, use μs here).
If it's going to continue moving, now you need a new function to describe the next half-cycle. Now the direction of the friction is reversed so the differential equation to solve is:
m" + kx = -μm
with new initial condition: x(t1) = x1 using the values you found when the block stopped.
And so on...
For each half-cycle there will be a new equation describing that segment of the graph, and at the end of each segment, you have to compare the spring force to the frictional force to see whether the block starts moving again, or remains at rest. Eventually, the block just comes to a stop someplace (not necessarily at x=0).
Ugh. Have fun.