No BSD License
-
X=dtftsinc(M,w)
DTFTSINC calculates samples of the discrete-time sinc function.
-
[bc,ac]=df2cf(b,a)
DF2CF Converts a filter from direct form to cascade form.
-
[poles,zeros]=pzplot(b,a,ROC)
PZPLOT plots the poles and zeros of a continuous-time LTI system.
-
ctfts(x,T)
CTFTS calculates the continuous-time Fourier transform (CTFT)
-
dpzplot(b,a)
DPZPLOT plots the poles and zeros of a discrete-time LTI system.
-
eyediagram(y,fs,dt)
EYEDIAGRAM plots the eye diagram for pulse amplitude modulation.
-
quant(x,N,m)
QUANT quantizes the elements of a vector.
-
View all files
|
|
| quant(x,N,m) |
function qc = quant(x,N,m)
%QUANT quantizes the elements of a vector.
%
% Usage: q = quant(x,N,m)
%
% Each element of the vector 'x' is quantized into 2^N bit values,
% where 'm' is the value of the maximum amplitude of any element in
% 'x'. The quantized levels are from -m to m (not including m).
%---------------------------------------------------------------
% copyright 1996, by John Buck, Michael Daniel, and Andrew Singer.
% For use with the textbook "Computer Explorations in Signals and
% Systems using MATLAB", Prentice Hall, 1997.
%---------------------------------------------------------------
[mm,nn]=size(x);
qc=zeros(mm,nn);
levels = 2^(N-1);
maxlevel = 2^N-1;
for k=1:mm,
tmp = fix((x(k,:)+m) ./ (m/levels));
q = zeros(1,nn);
q(tmp <= maxlevel) = tmp(tmp <= maxlevel);
q(tmp > maxlevel) = maxlevel * ones(1,length(tmp(tmp > maxlevel)));
q(tmp < 0) = zeros(tmp(tmp < 0));
q = (q-levels)*m/levels;
qc(k,:)=q;
end
|
|
Contact us at files@mathworks.com