⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_2_non_bis.m

📁 audio compression matlab code
💻 M
字号:
clc; clear; clf;
% non-linear transforms 
% test_2_non with fucntions..
warning off;



%the number of the input-output bits...
nbits_in = 15; 
nbits_out = 7;

% define the range
x_min = -2^nbits_in  ;
x_max = + 2^nbits_in -1;
in_range =  x_max - x_min;

step = 100;
x = x_min:step:x_max;

y_min = - 2^nbits_out  ;
y_max = + 2^nbits_out -1;
out_range =  y_max - y_min;

% 1. Compression: x input; y output
n = length(x);
V = max(x);
% function y = f_nonlin_compand(x, type, V, nbits_in, nbits_out)
y = f_nonlin_compand(x, 1, V, nbits_in, nbits_out);

% 2. Extention: y input ; xb output
xb = f_nonlin_compand(y, 2, V, nbits_out, nbits_in);



subplot(221), stairs(x,y); title('Compression'); 
% axis([x_min x_max y_min y_max]); grid;

subplot(222), stairs(y,xb); title('Expanding');
grid;
% axis([x_min x_max x_min x_max]);

subplot(223), plot(x, xb);grid;
title('transfer characteristic');

subplot(224),  stairs(x, (xb -x) ./ x .* 100); 
axis([x_min x_max x_min x_max]);title('Reconstruction Error [%]');

⌨️ 快捷键说明

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