필터 지우기
필터 지우기

How to quantise a sin wave with amplitude between -1 to 1?

조회 수: 1 (최근 30일)
Sarah Ghosh
Sarah Ghosh 2014년 2월 7일
댓글: Azzi Abdelmalek 2014년 2월 9일
I have to quantise a continuous sin wave into a 16 bit signal and obtain the vector of the quantised signals in the binary form? How to get the binary of a decimal number which might be negative. Can anyone provide me with the code snippet for that?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 7일
ts=0.01 % sample time
t=0:ts:10; % time vector
y=sin(t); % your signal
pas=(1-(-1))/(2^15-1) % quantization interval
ye=round(y/pas)
s=sign(ye')
s(s<=0)=0
yq=[num2str(s) dec2bin(abs(ye))] % use the first bit to define positive and negative numbers
  댓글 수: 2
Sarah Ghosh
Sarah Ghosh 2014년 2월 9일
Thanks a lot for the answer. Now, I need each of those 15 bits as the output. How do I do that?
Azzi Abdelmalek
Azzi Abdelmalek 2014년 2월 9일
Sarah, if you have another question, post a new one and make it as clear as possible

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2014년 2월 7일
편집: Walter Roberson 2014년 2월 7일
dec2bin(typecast(int16(floor(sin(t) * 32767)), 'uint16'), 16) - '0'

카테고리

Help CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by