examp47.m

来自「ADSP TOOLBOX: Version 2.0 and gui m-file」· M 代码 · 共 15 行

M
15 行
字号

clc,echo on 
%EXAMPLE 47 
N=200;t=(0:N-1)*0.01;                 % Time array 
x=sin(2*pi*t);                        % DT sampled signal 
d=max(x)-min(x);                      % Dynamic range 
b=3;L=2^b;                            % Number of levels 
s=d/L;                                % Step size 
y=s*round(x/s);                       % round (use FLOOR to truncate) 
plot(t,x);hold on,                    % Overplot CT signal samples
dtplot(t,y);hold off,pause(2)         % And quantized signal. 
e=x-y;hist(e,L);                      % Error signal and its histogram. 
snra=10*log10(sum(x.*x)/sum(e.*e))    % Quantization SNR
echo off %end of example

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?