def linspace(start, stop, n):
    """Generate a linear interpolation between start and stop with n steps."""
    if n == 1:
        yield stop
        return
    h = (stop - start) / (n - 1)
    for i in range(n):
        yield start + h * i
