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

📄 elg.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:

set_param([sys,'/',['Discrete',13,' Early-Late',13,' Gate']],...
		'orientation',2,...
		'position',[325,223,365,287])

add_block('built-in/Mux',[sys,'/','Mux'])
set_param([sys,'/','Mux'],...
		'hide name',0,...
		'inputs','3',...
		'position',[330,135,360,185])


%     Subsystem  'Graph1'.

new_system([sys,'/','Graph1'])
set_param([sys,'/','Graph1'],'Location',[0,59,274,252])

add_block('built-in/S-Function',[sys,'/',['Graph1/S-function',13,'M-file which plots',13,'lines',13,'']])
set_param([sys,'/',['Graph1/S-function',13,'M-file which plots',13,'lines',13,'']],...
		'function name','sfuny',...
		'parameters','ax, color,dt',...
		'position',[130,55,180,75])

add_block('built-in/Inport',[sys,'/','Graph1/x'])
set_param([sys,'/','Graph1/x'],...
		'position',[65,55,85,75])
add_line([sys,'/','Graph1'],[90,65;125,65])
set_param([sys,'/','Graph1'],...
		'Mask Display','plot(0,0,100,100,[90,10,10,10,90,90,10],[65,65,90,40,40,90,90],[90,78,69,54,40,31,25,10],[77,60,48,46,56,75,81,84])',...
		'Mask Type','Graph scope.')
set_param([sys,'/','Graph1'],...
		'Mask Dialogue','Graph scope using MATLAB graph window.\nEnter plotting ranges and line type:|Time range:|y-min:|y-max:|Line type (rgbw-:*). Seperate each plot by ''/'':|Sample time:')
set_param([sys,'/','Graph1'],...
		'Mask Translate','color = @4; ax = [0, @1, @2, @3]; dt = @5;')
set_param([sys,'/','Graph1'],...
		'Mask Help','This block plots to the MATLAB graph window and can be used as an improved version of the Scope block. Look at the m-file sfuny.m to see how it works. This block can take scalar or vector input signal.')
set_param([sys,'/','Graph1'],...
		'Mask Entries','5/600\/-10\/10\/''b-/y-/g--/c-./w:/m*/ro/b+''\/tss\/')


%     Finished composite block 'Graph1'.

set_param([sys,'/','Graph1'],...
		'hide name',0,...
		'position',[390,140,420,180])


%     Subsystem  'SNR Generator'.

new_system([sys,'/','SNR Generator'])
set_param([sys,'/','SNR Generator'],'Location',[355,528,737,675])

add_block('built-in/S-Function',[sys,'/','SNR Generator/Message source'])
set_param([sys,'/','SNR Generator/Message source'],...
		'BackGround',5,...
		'function name','trigwksp',...
		'parameters','var,thd,cyclFlag,ini',...
		'Mask Display','Triggered\nread',...
		'Mask Type','Read from workspace')
set_param([sys,'/','SNR Generator/Message source'],...
		'Mask Dialogue','The raising edge of input pulse trigger the block output the next row from the workspace variable.|Read the variable:|Threshold for the input pulse:|Cyclic read variable (1) or amend zeros (0).|Output before first trigger:')
set_param([sys,'/','SNR Generator/Message source'],...
		'Mask Translate','var=@1;thd=@2;cyclFlag=@3;ini=@4;',...
		'Mask Help','This block reads the data from a workspace variable. The output is refreshed at the raising edge of the input pulse.')
set_param([sys,'/','SNR Generator/Message source'],...
		'Mask Entries','var\/.1\/cyc\/ini\/',...
		'position',[180,53,255,97])

add_block('built-in/Outport',[sys,'/','SNR Generator/out_1'])
set_param([sys,'/','SNR Generator/out_1'],...
		'position',[295,65,315,85])


%     Subsystem  ['SNR Generator/Pulses deivide',13,'same sample time1'].

new_system([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']])
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],'Location',[55,192,283,286])

add_block('built-in/Outport',[sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1/Outport']])
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1/Outport']],...
		'position',[160,35,180,55])

add_block('built-in/S-Function',[sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1/S-function1']])
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1/S-function1']],...
		'function name','homopuls',...
		'parameters','samp_time, out_divid, offset',...
		'position',[40,31,105,59])
add_line([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],[110,45;155,45])
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],...
		'Mask Display','Vector\nPulse',...
		'Mask Type','Pulse generator')
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],...
		'Mask Dialogue','Vector pulses with sample rate of each pulse as Sample_time ./Divider. |Sample time (scalar, sec):|Divider (integer vector):|Offset (have same dimension as Divider:')
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],...
		'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;')
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],...
		'Mask Help','This block generator a vector pulses. The output length is the same as the vector defined in "Divider". The ith element of the output has the sample time Sample_time/Divider(i). All elements in "Divider" must be integers.')
set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],...
		'Mask Entries','ts\/1\/off\/')


%     Finished composite block ['SNR Generator/Pulses deivide',13,'same sample time1'].

set_param([sys,'/',['SNR Generator/Pulses deivide',13,'same sample time1']],...
		'position',[50,56,110,94])
add_line([sys,'/','SNR Generator'],[115,75;175,75])
add_line([sys,'/','SNR Generator'],[260,75;290,75])
set_param([sys,'/','SNR Generator'],...
		'Mask Display','plot(0,0,100,100,x,y);Rd wksp',...
		'Mask Type','Read from workspace')
set_param([sys,'/','SNR Generator'],...
		'Mask Dialogue','Read from a workspace variable at\nsampling time point.|Variable (column_number=block_output_length):|Data output sample time (sec):|Cyclic control (1: cyclic read, 0: output zeros after eof).|Initial output:')
set_param([sys,'/','SNR Generator'],...
		'Mask Translate','var=@1;td=@2;ts=td(1);if (length(td)>=2),off=td(2);else off=0;end;cyc=@3;ini=@4;[x,y]=srcsicon(7);')
set_param([sys,'/','SNR Generator'],...
		'Mask Help','This block reads from a workspace variable at a given sample time. The column number is the block output vector length. When the simulation reached the end of the variable (eof) row, the block will cyclically output from the first row of the variable or output zeros based on the cyclic control entree.')
set_param([sys,'/','SNR Generator'],...
		'Mask Entries','(-5:6)''\/tdd*20\/1\/0\/')


%     Finished composite block 'SNR Generator'.

set_param([sys,'/','SNR Generator'],...
		'ForeGround',4,...
		'hide name',0,...
		'position',[180,90,260,130])


%     Subsystem  '.'.

new_system([sys,'/','.'])
set_param([sys,'/','.'],'Location',[44,367,780,580])

add_block('built-in/Inport',[sys,'/','./in_2'])
set_param([sys,'/','./in_2'],...
		'Port','2',...
		'position',[75,30,95,50])


%     Subsystem  ['./Pulses divide',13,'same sample time1'].

new_system([sys,'/',['./Pulses divide',13,'same sample time1']])
set_param([sys,'/',['./Pulses divide',13,'same sample time1']],'Location',[55,192,283,286])

add_block('built-in/S-Function',[sys,'/',['./Pulses divide',13,'same sample time1/S-function1']])
set_param([sys,'/',['./Pulses divide',13,'same sample time1/S-function1']],...
		'function name','homopuls',...
		'parameters','samp_time, out_divid, offset',...
		'position',[40,31,105,59])

add_block('built-in/Outport',[sys,'/',['./Pulses divide',13,'same sample time1/Outport']])
set_param([sys,'/',['./Pulses divide',13,'same sample time1/Outport']],...
		'position',[160,35,180,55])
add_line([sys,'/',['./Pulses divide',13,'same sample time1']],[110,45;155,45])
set_param([sys,'/',['./Pulses divide',13,'same sample time1']],...
		'Mask Display','plot(0,0,100,100,x,y);Pulse',...
		'Mask Type','Pulse generator')
set_param([sys,'/',['./Pulses divide',13,'same sample time1']],...
		'Mask Dialogue','Vector pulses with sample rate of each pulse as Sample_time / Divider.|Sample time (scalar, sec):|Divider (integer vector):|Offset (same length as Divider):')
set_param([sys,'/',['./Pulses divide',13,'same sample time1']],...
		'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;[x,y]=srcsicon(2);')
set_param([sys,'/',['./Pulses divide',13,'same sample time1']],...
		'Mask Help','This block generates a vector pulse. The output length is the same as the divider vector length. The ith element of the output has the sample time Sample_time/Divider(i). All elements in divider must be integers.')
set_param([sys,'/',['./Pulses divide',13,'same sample time1']],...
		'Mask Entries','tss\/1\/0\/')


%     Finished composite block ['./Pulses divide',13,'same sample time1'].

set_param([sys,'/',['./Pulses divide',13,'same sample time1']],...
		'position',[40,98,120,142])

add_block('built-in/Product',[sys,'/','./Product'])
set_param([sys,'/','./Product'],...
		'position',[450,98,480,122])

add_block('built-in/Gain',[sys,'/','./Gain'])
set_param([sys,'/','./Gain'],...
		'Gain','1/256',...
		'position',[390,92,415,118])


%     Subsystem  ['./Inner',13,'Product'].

new_system([sys,'/',['./Inner',13,'Product']])
set_param([sys,'/',['./Inner',13,'Product']],'Location',[33,479,253,634])

add_block('built-in/Product',[sys,'/',['./Inner',13,'Product/Product']])
set_param([sys,'/',['./Inner',13,'Product/Product']],...
		'position',[65,55,90,75])

add_block('built-in/Sum',[sys,'/',['./Inner',13,'Product/Sum']])
set_param([sys,'/',['./Inner',13,'Product/Sum']],...
		'inputs','+',...
		'position',[125,55,145,75])

add_block('built-in/Outport',[sys,'/',['./Inner',13,'Product/out_1']])
set_param([sys,'/',['./Inner',13,'Product/out_1']],...
		'position',[185,55,205,75])

add_block('built-in/Inport',[sys,'/',['./Inner',13,'Product/in_2']])
set_param([sys,'/',['./Inner',13,'Product/in_2']],...
		'Port','2',...
		'position',[15,90,35,110])

add_block('built-in/Inport',[sys,'/',['./Inner',13,'Product/in_1']])
set_param([sys,'/',['./Inner',13,'Product/in_1']],...
		'position',[15,25,35,45])
add_line([sys,'/',['./Inner',13,'Product']],[40,100;60,70])
add_line([sys,'/',['./Inner',13,'Product']],[40,35;60,60])
add_line([sys,'/',['./Inner',13,'Product']],[95,65;120,65])
add_line([sys,'/',['./Inner',13,'Product']],[150,65;180,65])
set_param([sys,'/',['./Inner',13,'Product']],...
		'Mask Display','.\n',...
		'Mask Type','Dot Product',...
		'Mask Dialogue','Inner (dot) product.\ny=sum(u1.*u2)')
set_param([sys,'/',['./Inner',13,'Product']],...
		'Mask Help','Computes the inner (dot) product of the inputs: sum(u1.*u2).  The inputs are vectors of the same length. Output is a scalar.')


%     Finished composite block ['./Inner',13,'Produ

⌨️ 快捷键说明

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