That is not an analog signal. An analog signal is created by outputing to a hardware device. What you have is a digital signal.
Your description said I denotes quantization levels. If so then
binnumber = discretize(x, I) - 1;
num_bits = ceil(log2(length(I)))
as_char_binary = dec2bin(binnumber, num_bits);
binary_stream = reshape((as_char_binary - '0').',1,);
stairs(binary_stream); ylim([-.1 1.1]); xlim([0 50])