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

📄 com_frmt.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 4 页
字号:
set_param([sys,'/',['A-law',13,'compressor/Switch']],...
		'Threshold','.2',...
		'position',[455,59,480,91])

add_block('built-in/Constant',[sys,'/',['A-law',13,'compressor/Constant1']])
set_param([sys,'/',['A-law',13,'compressor/Constant1']],...
		'ForeGround',3,...
		'Value','VdA',...
		'position',[230,70,260,90])

add_block('built-in/Relational Operator',[sys,'/',['A-law',13,'compressor/Relational',13,'Operator']])
set_param([sys,'/',['A-law',13,'compressor/Relational',13,'Operator']],...
		'BackGround',5,...
		'Operator','<=',...
		'position',[340,58,370,87])

add_block('built-in/Product',[sys,'/',['A-law',13,'compressor/Product1']])
set_param([sys,'/',['A-law',13,'compressor/Product1']],...
		'BackGround',7,...
		'position',[520,88,545,112])

add_block('built-in/Outport',[sys,'/',['A-law',13,'compressor/out_1']])
set_param([sys,'/',['A-law',13,'compressor/out_1']],...
		'position',[580,90,600,110])

add_block('built-in/Abs',[sys,'/',['A-law',13,'compressor/Abs']])
set_param([sys,'/',['A-law',13,'compressor/Abs']],...
		'position',[115,53,145,77])

add_block('built-in/Inport',[sys,'/',['A-law',13,'compressor/Inport']])
set_param([sys,'/',['A-law',13,'compressor/Inport']],...
		'position',[40,55,60,75])
add_line([sys,'/',['A-law',13,'compressor']],[425,140;430,140;430,85;450,85])
add_line([sys,'/',['A-law',13,'compressor']],[355,135;385,135])
add_line([sys,'/',['A-law',13,'compressor']],[370,175;375,175;385,145])
add_line([sys,'/',['A-law',13,'compressor']],[250,175;305,175;305,140;325,140])
add_line([sys,'/',['A-law',13,'compressor']],[305,130;325,130])
add_line([sys,'/',['A-law',13,'compressor']],[230,130;250,130])
add_line([sys,'/',['A-law',13,'compressor']],[150,65;335,65])
add_line([sys,'/',['A-law',13,'compressor']],[170,65;170,35;270,35])
add_line([sys,'/',['A-law',13,'compressor']],[170,65;170,125;190,125])
add_line([sys,'/',['A-law',13,'compressor']],[160,135;190,135])
add_line([sys,'/',['A-law',13,'compressor']],[140,25;270,25])
add_line([sys,'/',['A-law',13,'compressor']],[310,30;410,30;410,65;450,65])
add_line([sys,'/',['A-law',13,'compressor']],[375,75;450,75])
add_line([sys,'/',['A-law',13,'compressor']],[265,80;335,80])
add_line([sys,'/',['A-law',13,'compressor']],[485,75;495,75;495,95;515,95])
add_line([sys,'/',['A-law',13,'compressor']],[175,205;490,205;490,105;515,105])
add_line([sys,'/',['A-law',13,'compressor']],[65,65;110,65])
add_line([sys,'/',['A-law',13,'compressor']],[80,65;80,205;120,205])
add_line([sys,'/',['A-law',13,'compressor']],[550,100;575,100])
set_param([sys,'/',['A-law',13,'compressor']],...
		'Mask Display','A-law\ncompressor',...
		'Mask Type','A-law compressor')
set_param([sys,'/',['A-law',13,'compressor']],...
		'Mask Dialogue','Compress the input signal using A-law\ncompressor. The A-law compressor\nuses logarithm computation.|A value:|Peak signal magnitude:')
set_param([sys,'/',['A-law',13,'compressor']],...
		'Mask Translate','A=@1;V=@2;lnA1=log(A)+1;AdlnA1=A/lnA1;VdlnA1=V/lnA1;VdA=V/A;AdV=A/V;')
set_param([sys,'/',['A-law',13,'compressor']],...
		'Mask Help','This block processes a vector signal. The output has the same length as the input signal. The prevailing value for A is A=87.6.',...
		'Mask Entries','87.6\/1\/')


%     Finished composite block ['A-law',13,'compressor'].

set_param([sys,'/',['A-law',13,'compressor']],...
		'position',[35,283,115,327])


%     Subsystem  ['Enabled',13,'quantizer encode'].

new_system([sys,'/',['Enabled',13,'quantizer encode']])
set_param([sys,'/',['Enabled',13,'quantizer encode']],'Location',[37,101,520,257])

add_block('built-in/Inport',[sys,'/',['Enabled',13,'quantizer encode/in_1']])
set_param([sys,'/',['Enabled',13,'quantizer encode/in_1']],...
		'position',[40,45,60,65])

add_block('built-in/Mux',[sys,'/',['Enabled',13,'quantizer encode/Mux']])
set_param([sys,'/',['Enabled',13,'quantizer encode/Mux']],...
		'inputs','[n 1]',...
		'position',[115,46,150,79])

add_block('built-in/Inport',[sys,'/',['Enabled',13,'quantizer encode/in_2']])
set_param([sys,'/',['Enabled',13,'quantizer encode/in_2']],...
		'Port','2',...
		'position',[40,105,60,125])

add_block('built-in/S-Function',[sys,'/',['Enabled',13,'quantizer encode/S-function']])
set_param([sys,'/',['Enabled',13,'quantizer encode/S-function']],...
		'function name','simquan',...
		'parameters','n, partition, codebook',...
		'position',[190,55,240,75])

add_block('built-in/Demux',[sys,'/',['Enabled',13,'quantizer encode/Demux']])
set_param([sys,'/',['Enabled',13,'quantizer encode/Demux']],...
		'outputs','[n n n]',...
		'position',[280,47,320,83])

add_block('built-in/Outport',[sys,'/',['Enabled',13,'quantizer encode/out_1']])
set_param([sys,'/',['Enabled',13,'quantizer encode/out_1']],...
		'position',[385,20,405,40])

add_block('built-in/Outport',[sys,'/',['Enabled',13,'quantizer encode/out_2']])
set_param([sys,'/',['Enabled',13,'quantizer encode/out_2']],...
		'Port','2',...
		'position',[420,55,440,75])

add_block('built-in/Outport',[sys,'/',['Enabled',13,'quantizer encode/out_3']])
set_param([sys,'/',['Enabled',13,'quantizer encode/out_3']],...
		'Port','3',...
		'position',[385,85,405,105])
add_line([sys,'/',['Enabled',13,'quantizer encode']],[65,55;110,55])
add_line([sys,'/',['Enabled',13,'quantizer encode']],[65,115;80,115;80,70;110,70])
add_line([sys,'/',['Enabled',13,'quantizer encode']],[155,65;185,65])
add_line([sys,'/',['Enabled',13,'quantizer encode']],[245,65;275,65])
add_line([sys,'/',['Enabled',13,'quantizer encode']],[325,55;340,55;340,30;380,30])
add_line([sys,'/',['Enabled',13,'quantizer encode']],[325,65;415,65])
add_line([sys,'/',['Enabled',13,'quantizer encode']],[325,75;340,75;340,95;380,95])
set_param([sys,'/',['Enabled',13,'quantizer encode']],...
		'Mask Display','plot(0,0,100,100,v,w);Quantizer',...
		'Mask Type','Scalar quantization encode')
set_param([sys,'/',['Enabled',13,'quantizer encode']],...
		'Mask Dialogue','Triggered by 2nd input signal, this block\nquantize an analog signal to (1)digital\nsignal, (2)quantization value, (3)distortion.|Quantization partition:|Quantization codebook:|Input signal vector length:')
set_param([sys,'/',['Enabled',13,'quantizer encode']],...
		'Mask Translate','partition=@1;codebook=@2;n=@3;[v,w]=trigicon(0,25,get_param(gcb,''orientation''));')
set_param([sys,'/',['Enabled',13,'quantizer encode']],...
		'Mask Help','This block quantizes the first inport signal into quantization index (1st outport), quantized value (2nd outport), and distortion (3rd outport). This block uses scalar quantization method. The input signal to the 1st inport can be a vector. The operation of this block is enabled by the non-zero signal from the second inport. When the block is not enabled, the block keeps the last output value.')
set_param([sys,'/',['Enabled',13,'quantizer encode']],...
		'Mask Entries','[-.75 -.25 .25 .75]\/[-.825 -.5 0 .5 .825]\/2\/')


%     Finished composite block ['Enabled',13,'quantizer encode'].

set_param([sys,'/',['Enabled',13,'quantizer encode']],...
		'position',[35,358,115,402])


%     Subsystem  ['Quantizer',13,'decode2'].

new_system([sys,'/',['Quantizer',13,'decode2']])
set_param([sys,'/',['Quantizer',13,'decode2']],'Location',[596,274,888,411])

add_block('built-in/Inport',[sys,'/',['Quantizer',13,'decode2/in_1']])
set_param([sys,'/',['Quantizer',13,'decode2/in_1']],...
		'position',[20,30,40,50])

add_block('built-in/Outport',[sys,'/',['Quantizer',13,'decode2/out_1']])
set_param([sys,'/',['Quantizer',13,'decode2/out_1']],...
		'position',[225,30,245,50])

add_block('built-in/S-Function',[sys,'/',['Quantizer',13,'decode2/Index lookup',13,'table']])
set_param([sys,'/',['Quantizer',13,'decode2/Index lookup',13,'table']],...
		'function name','indxtabl',...
		'parameters','codebook',...
		'Mask Display','Index\nLookup tb',...
		'Mask Type','No-intepret Lookup table')
set_param([sys,'/',['Quantizer',13,'decode2/Index lookup',13,'table']],...
		'Mask Dialogue','Output one of the values in the look-up table.|Codebook:',...
		'Mask Translate','codebook=@1;')
set_param([sys,'/',['Quantizer',13,'decode2/Index lookup',13,'table']],...
		'Mask Help','When codebook is a matrix, the block input can only be a scalar. The block output the row with the column index provided in the input. When codebook is a vector, the block output the same length as the input vector. The output is one of the values in codebook with the index provided by the input.')
set_param([sys,'/',['Quantizer',13,'decode2/Index lookup',13,'table']],...
		'Mask Entries','codebook\/',...
		'position',[105,19,165,61])
add_line([sys,'/',['Quantizer',13,'decode2']],[170,40;220,40])
add_line([sys,'/',['Quantizer',13,'decode2']],[45,40;100,40])
set_param([sys,'/',['Quantizer',13,'decode2']],...
		'Mask Display','Quantizer\ndecode',...
		'Mask Type','Scalar quantization decode')
set_param([sys,'/',['Quantizer',13,'decode2']],...
		'Mask Dialogue','Output the value in the given codebook\nbased on the input index value.|Quantization codebook:',...
		'Mask Translate','codebook=@1;')
set_param([sys,'/',['Quantizer',13,'decode2']],...
		'Mask Help','This block takes the quantized index as input and outputs the quantization value. The output vector size the is same as the input vector size. Inputs 0, 1, ..., N-1 lead to CK(1), CK(2), .. CK(N) output.')
set_param([sys,'/',['Quantizer',13,'decode2']],...
		'Mask Entries','[-.825 -.5 0, .5 .825]\/')


%     Finished composite block ['Quantizer',13,'decode2'].

set_param([sys,'/',['Quantizer',13,'decode2']],...
		'position',[170,358,250,402])

add_block('built-in/Note',[sys,'/','Source Coding//Decoding Library'])
set_param([sys,'/','Source Coding//Decoding Library'],...
		'ForeGround',3,...
		'Font Weight','bold',...
		'Font Size',12,...
		'position',[195,11,200,16])


%     Subsystem  ['Sampled',13,'quantizer demo'].

new_system([sys,'/',['Sampled',13,'quantizer demo']])
set_param([sys,'/',['Sampled',13,'quantizer demo']],'Location',[811,642,1004,748])
set_param([sys,'/',['Sampled',13,'quantizer demo']],...
		'Mask Display','Sampled\nquantizer\ndemo',...
		'Mask Dialogue','eval(''tstquans;'')')


%     Finished composite block ['Sampled',13,'quantizer demo'].

set_param([sys,'/',['Sampled',13,'quantizer demo']],...
		'orientation',2,...
		'BackGround',7,...
		'position',[295,58,375,102])


%     Subsystem  ['DPCM',13,'demo'].

new_system([sys,'/',['DPCM',13,'demo']])
set_param([sys,'/',['DPCM',13,'demo']],'Location',[811,642,1004,748])
set_param([sys,'/',['DPCM',13,'demo']],...
		'Mask Display','DPCM\ndemo',...
		'Mask Dialogue','eval(''x=sin([0:.1:40]);[p_trans,codebook,partition]=dpcmopt(x,1,8);tstdpcms;'')')


%     Finished composite block ['DPCM',13,'demo'].

set_param([sys,'/',['DPCM',13,'demo']],...
		'orientation',2,...
		'BackGround',7,...
		'position',[295,133,375,177])


%     Subsystem  ['DPCM',13,'decode'].

new_system([sys,'/',['DPCM',13,'decode']])
set_param([sys,'/',['DPCM',13,'decode']],'Location',[32,515,384,677])

add_block('built-in/Inport',[sys,'/',['DPCM',13,'decode/in_1']])
set_param([sys,'/',['DPCM',13,'decode/in_1']],...
		'position',[30,40,50,60])


%     Subsystem  ['DPCM',13,'decode/Quantizer',13,'decode'].

new_system([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode']])
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode']],'Location',[596,274,888,411])

add_block('built-in/Inport',[sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/in_1']])
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/in_1']],...
		'position',[20,30,40,50])

add_block('built-in/Outport',[sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/out_1']])
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/out_1']],...
		'position',[225,30,245,50])

add_block('built-in/S-Function',[sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/Index lookup',13,'table']])
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/Index lookup',13,'table']],...
		'function name','indxtabl',...
		'parameters','codebook',...
		'Mask Display','Index\nLookup tb',...
		'Mask Type','No-intepret Lookup table')
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/Index lookup',13,'table']],...
		'Mask Dialogue','Output one of the values in the look-up table.|Codebook:',...
		'Mask Translate','codebook=@1;')
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/Index lookup',13,'table']],...
		'Mask Help','When codebook is a matrix, the block input can only be a scalar. The block output the row with the column index provided in the input. When codebook is a vector, the block output the same length as the input vector. The output is one of the values in codebook with the index provided by the input.')
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode/Index lookup',13,'table']],...
		'Mask Entries','codebook\/',...
		'position',[105,19,165,61])
add_line([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode']],[170,40;220,40])
add_line([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode']],[45,40;100,40])
set_param([sys,'/',['DPCM',13,'decode/Quantizer',13,'decode']],...

⌨️ 快捷键说明

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