Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ANALOG SIGNAL TO 8 BITS SIGNAL

Status
Not open for further replies.

RafaelCastro

Electrical
Feb 10, 2015
4
0
0
PT
HI everyone !

I'm doing a program to transform a normal sine wave into a 8 bits signal

I'm just a beginner and i want your help to know if i'm doing it right.

I give you here the algoritm that i think it work


range = 5 % the max of my sin wave
n8 = 8; % number of bits
q8 = range/(2^n8); % quantization interval
quant8=composto/q8;

a8=fix(quant8);

sinalcod8=a8*q8; my final signal


Thanks
 
Replies continue below

Recommended for you

One comment...

You may find that your target 8-bit format uses unsigned integers (0-255), whereas your raw data is likely negative and positive. For 16-bit, signed integers are more common. So you probably need to decide whether to apply an offset based on the number of bits.

- Steve
 
Hi Steve,

Now i use this function, dec2bin to transform this to an bin code. but i dont know how to represent this on a graph like plot.

Can you help me ?

sinal_digital8 = dec2bin(abs(a8),n8);


thanks ;)
 
... I can't find a solution to my problem... :/ when i want to transform binary to gray code i find an error Undefined function 'grey2bin' for input arguments of type 'char'. and i can't plot my matrix of binary code... i want to represent like a square pulse

thanks
 
Status
Not open for further replies.
Back
Top