how to convert digital data into analog data using matlab code? and vice versa... i.e., converting back analog data into digital data?
Prashant Kumar answered .
2025-11-20
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