模拟信号压缩与解压matlab.doc

  1. 1、本文档共7页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
模拟信号压缩与解压matlab

function [y,G_out] = expanderINT16clip(x,Fd,G_in,M) %expander % y = expanderINT16clip(x,Fd,G_in,M) %x -- the input signal array %Fd -- the full deviated amplitude %G_in -- the initial Gain %M -- update the expander gain every M samples % %y -- the expanded signal array %G_out -- the output Gain % %Companding Specificationn % Compression Ratio 2:1 % Crossover Point 60% of full audio deviation % Attack Time 3.3 ms % Recovery Time 14.85 ms % % INT16_SCALE = 32768; persistent ae ae_1 average counter mean old_x_array ae1 ae1_1 ae2 ae2_1 ae_diff ae_diff_1; %initialization if isempty(ae) ae1 = float2Fract(0.99436); ae1_1 = 2^31 - fract2LongFract(ae1); %float2LongFract((1-0.99436)); ae2 = float2Fract(0.99985); ae2_1 = 2^31 - fract2LongFract(ae2); %float2LongFract((1-0.99985)); ae_diff = float2Fract(0.9995); ae_diff_1 = 2^31 - fract2LongFract(ae_diff); counter = 0; average = 0; mean = 0; old_x_array = zeros(1,40); end Ue = fractMult(float2Fract(0.6366),Fd); ae = ae1; ae_1 = ae1_1; global mean_e_g average_e_g diff_e_g avg_dif_e_g Ge_g flag_e_g avg_dif_float_e_g; %test only avg_dif = 0; avg_dif_float = 0; %test only OneForty = float2Fract(1/40); temp1 = 0; temp2 = 0; scale_flag = 0; for i = 1:length(x) abstract = abs(x(i)); temp1 = longLongFractMult(temp1,ae) + longLongFractMult(ae_1,abstract); %averager. divide 2^15 for fractional multiplication. average = longFract2Fract(temp1); average_e_g(i) = average; %test only mean = mean - fractMult(OneForty,old_x_array(1)) + fractMult(OneForty,abstract); %update mean mean_e_g(i)= mean; %test only if counter == 0 %update gain every M times G_in = average/Ue; G_in_floor = floor(G_in); G_in_fract = float2Fract(G_in - floor(G_in));

文档评论(0)

qwd513620855 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档