Quantize an analog signal
이전 댓글 표시
I have an analog signal(ECG) ranging in amplitude from 0.1 to 2.5 and I want to quantize it, to convert the ECG signal into bit stream. The problem I am facing is I don't know what parameters in quantize function will lead to the required quantization range.
Can anyone help me in how to do this using quantize function and what should be the parameters that will lead me to the required range of quantization values.
댓글 수: 1
Walter Roberson
2019년 5월 27일
Due to the laws of the USA, we are not permitted to discuss encryption.
답변 (3개)
Rick Rosson
2012년 4월 12일
Quantize Function
function y = quantize(x)
xMin = 0.1;
xMax = 2.5;
N = 64;
y = floor( N * log(x/xMin) / log(xMax/xMin) ) ;
end
Test Script
x = 0.1 + 2.4*rand(100,1);
y = quantize(x);
scatter(x,y);
HTH.
Rick
댓글 수: 5
Anas Imtiaz
2013년 3월 16일
This does not work for a sinusoidal function. I don't think this is a valid generic solution.
Rick Rosson
2013년 3월 17일
It's kind of difficult to provide a general solution when the questioner has not provided all of the necessary information to answer the question. That's why I parameterized my solution, so that it can act as an example of one possible method, and it can be modified depending on the specific requirements.
Neha Gupta
2019년 3월 26일
i have an Speech signal whose amplitudes are always in the range of -1 and 1. Acoording to your solution my quantized output will always be 0. What changes would you suggest?
Walter Roberson
2019년 3월 26일
The above code assumes non-negative numbers (notice the log() calls).
Neha Gupta, are you looking for uniform quantization, or non-uniform? If you want non-uniform, then how do you want to determine the widths of the bins ?
Image Analyst
2019년 3월 27일
Why not use imquantize() from the Image Processing Toolbox where you can specify the edges of the ranges to quantize?
Rick Rosson
2012년 4월 10일
1 개 추천
- How many quantization levels do you want to have?
- Do you want uniformly spaced levels, or non?
- Is the signal signed or unsigned?
댓글 수: 2
Shravan Kumar Pasupuleti
2012년 4월 12일
Rick Rosson
2012년 4월 12일
Is the value of the signal always greater than zero (one-sided), or is it less than zero some of the time (two-sided)?
Image Analyst
2013년 3월 17일
0 개 추천
If it's already in MATLAB then it's already been quantized. This just changes the quantization to some other quantization. I got the impression he had an analog signal that he needed to quantize (digitize). For that he'd probably need the Data Acquisition Toolbox and an appropriate A-to-D converter device, such as those from Measurement Computing Corporation (like I use) or any of the others listed here. That will take the actual input analog voltage signal and digitize it into a MATLAB variable.
카테고리
도움말 센터 및 File Exchange에서 Quantizers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!