Quantize an analog signal

44 ビュー (過去 30 日間)
Shravan Kumar Pasupuleti
Shravan Kumar Pasupuleti 2012 年 4 月 10 日
コメント済み: Walter Roberson 2019 年 5 月 27 日
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
Walter Roberson 2019 年 5 月 27 日
Due to the laws of the USA, we are not permitted to discuss encryption.

サインインしてコメントする。

回答 (3 件)

Rick Rosson
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 件のコメント
Walter Roberson
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
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
Rick Rosson 2012 年 4 月 10 日
  1. How many quantization levels do you want to have?
  2. Do you want uniformly spaced levels, or non?
  3. Is the signal signed or unsigned?
  2 件のコメント
Shravan Kumar Pasupuleti
Shravan Kumar Pasupuleti 2012 年 4 月 12 日
I want to have 64 quatization levels.
I want them to be non- uniform as the signal I am dealing is an ECG signal.
I don't know what are signed and unsigned signals?
Rick Rosson
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
Image Analyst 2013 年 3 月 17 日
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.

Community Treasure Hunt

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

Start Hunting!

Translated by