xlabel('n=n-axis'); ylabel('x=impulse sequense'); Title('Discrete Impulse Sequence plotting'); end U=10; % range signal from 0 to 10 n=3 % number of bits q=U/(2^n-1) % quantization interval t=0:0.1:10; % your time vector y=abs(10*sin(t)); % your signal % -------convert to a digital signal yd----------a=fix(y/q); yd=dec2bin(a,n) % ------you can calculate the signal yq ---------yq=a*q %------------------------------------------------plot(t,y,'r') hold on plot(t,yq,'g') hold off