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

📄 comcdcon.m

📁 数字通信第四版原书的例程
💻 M
📖 第 1 页 / 共 5 页
字号:
function [ret,x0,str,ts,xts]=comcdcon(t,x,u,flag);
%COMCDCON	is the M-file description of the SIMULINK system named COMCDCON.
%	The block-diagram can be displayed by typing: COMCDCON.
%
%	SYS=COMCDCON(T,X,U,FLAG) returns depending on FLAG certain
%	system values given time point, T, current state vector, X,
%	and input vector, U.
%	FLAG is used to indicate the type of output to be returned in SYS.
%
%	Setting FLAG=1 causes COMCDCON to return state derivatives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling COMCDCON with a FLAG of zero:
%	[SIZES]=COMCDCON([],[],[],0),  returns a vector, SIZES, which
%	contains the sizes of the state vector and other parameters.
%		SIZES(1) number of states
%		SIZES(2) number of discrete states
%		SIZES(3) number of outputs
%		SIZES(4) number of inputs
%		SIZES(5) number of roots (currently unsupported)
%		SIZES(6) direct feedthrough flag
%		SIZES(7) number of sample times
%
%	For the definition of other parameters in SIZES, see SFUNC.
%	See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.

% Note: This M-file is only used for saving graphical information;
%       after the model is loaded into memory an internal model
%       representation is used.

% the system will take on the name of this mfile:
sys = mfilename;
new_system(sys)
simver(1.3)
if (0 == (nargin + nargout))
     set_param(sys,'Location',[188,291,1004,517])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '999999')
set_param(sys,'Min step size', '0.0001')
set_param(sys,'Max step size', '10')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',   '')

add_block('built-in/Note',[sys,'/','Convolution Coding//Decoding Library'])
set_param([sys,'/','Convolution Coding//Decoding Library'],...
		'ForeGround',2,...
		'Font Weight','bold',...
		'Font Size',12,...
		'position',[245,5,250,10])


%     Subsystem  ['Vector convolution',13,'co//dec demo2'].

new_system([sys,'/',['Vector convolution',13,'co//dec demo2']])
set_param([sys,'/',['Vector convolution',13,'co//dec demo2']],'Location',[175,552,335,697])
set_param([sys,'/',['Vector convolution',13,'co//dec demo2']],...
		'Mask Display','Convolution\nco/dec\ndemo',...
		'Mask Dialogue','eval(''exconvcd;tf=sim2tran(''''exconvcd'''');tutconcd'')')


%     Finished composite block ['Vector convolution',13,'co//dec demo2'].

set_param([sys,'/',['Vector convolution',13,'co//dec demo2']],...
		'BackGround',7,...
		'hide name',0,...
		'position',[425,58,505,102])


%     Subsystem  ['Vector convolution',13,'co//dec demo'].

new_system([sys,'/',['Vector convolution',13,'co//dec demo']])
set_param([sys,'/',['Vector convolution',13,'co//dec demo']],'Location',[175,552,335,697])
set_param([sys,'/',['Vector convolution',13,'co//dec demo']],...
		'Mask Display','Convolution\nco/dec\ndemo',...
		'Mask Dialogue','eval(''fig_10_9;tf=sim2tran(''''fig_10_9'''');N_con_demo=tf(1,size(tf,2));K_con_demo=tf(2,size(tf,2));tstconcd'')')


%     Finished composite block ['Vector convolution',13,'co//dec demo'].

set_param([sys,'/',['Vector convolution',13,'co//dec demo']],...
		'BackGround',7,...
		'hide name',0,...
		'position',[295,58,375,102])


%     Subsystem  ['Sequence convolution',13,'co//dec demo'].

new_system([sys,'/',['Sequence convolution',13,'co//dec demo']])
set_param([sys,'/',['Sequence convolution',13,'co//dec demo']],'Location',[175,552,335,697])
set_param([sys,'/',['Sequence convolution',13,'co//dec demo']],...
		'Mask Display','Convolution\nco/dec\ndemo',...
		'Mask Dialogue','eval(''fig_10_9;tf=sim2tran(''''fig_10_9'''');leng=10;tstconsq'')')


%     Finished composite block ['Sequence convolution',13,'co//dec demo'].

set_param([sys,'/',['Sequence convolution',13,'co//dec demo']],...
		'BackGround',7,...
		'hide name',0,...
		'position',[295,138,375,182])


%     Subsystem  ['Binary sequence',13,'convolution encode'].

new_system([sys,'/',['Binary sequence',13,'convolution encode']])
set_param([sys,'/',['Binary sequence',13,'convolution encode']],'Location',[65,476,709,633])


%     Subsystem  ['Binary sequence',13,'convolution encode/Register-shift'].

new_system([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],'Location',[237,587,592,717])

add_block('built-in/Demux',[sys,'/',['Binary sequence',13,'convolution encode/Register-shift/Demux']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift/Demux']],...
		'outputs','[len_rg, 1]',...
		'position',[260,55,300,90])

add_block('built-in/S-Function',[sys,'/',['Binary sequence',13,'convolution encode/Register-shift/S-function']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift/S-function']],...
		'function name','regshift',...
		'parameters','shft_out, thrhld',...
		'position',[150,65,200,85])

add_block('built-in/Mux',[sys,'/',['Binary sequence',13,'convolution encode/Register-shift/Mux']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift/Mux']],...
		'inputs','2',...
		'position',[80,56,115,89])

add_block('built-in/Outport',[sys,'/',['Binary sequence',13,'convolution encode/Register-shift/out_1']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift/out_1']],...
		'position',[330,55,350,75])

add_block('built-in/Outport',[sys,'/',['Binary sequence',13,'convolution encode/Register-shift/out_2']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift/out_2']],...
		'Port','2',...
		'position',[330,70,350,90])

add_block('built-in/Inport',[sys,'/',['Binary sequence',13,'convolution encode/Register-shift/in_1']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift/in_1']],...
		'position',[30,55,50,75])

add_block('built-in/Inport',[sys,'/',['Binary sequence',13,'convolution encode/Register-shift/in_2']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift/in_2']],...
		'Port','2',...
		'position',[30,70,50,90])
add_line([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],[120,75;145,75])
add_line([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],[205,75;255,75])
add_line([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],[305,65;325,65])
add_line([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],[305,80;325,80])
add_line([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],[55,65;75,65])
add_line([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],[55,80;75,80])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],...
		'Mask Display','Register\nshift',...
		'Mask Type','Register-shift')
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],...
		'Mask Dialogue','Store and shift the input from 1st port by raising edge of the pulse from second port.|Vector specify ouput delay length(non-negative integer):|Threshold for the pulse signal from the 2nd port:')
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],...
		'Mask Translate','shft_out=@1; thrhld=@2; len_rg=length(@1);')
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],...
		'Mask Help','This block store the 1st inport signal at the raising edge of 2nd inport pulse. The 1st outport outputs a vector with its size same as the the size of the 1st entree of this block. The maximum delay is the register size of this block. The second outport output a positive pulse at the begining of entire register refreshment.')
set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],...
		'Mask Entries','[k:-1:1]\/.1\/')


%     Finished composite block ['Binary sequence',13,'convolution encode/Register-shift'].

set_param([sys,'/',['Binary sequence',13,'convolution encode/Register-shift']],...
		'BackGround',3,...
		'position',[230,25,285,65])

add_block('built-in/Inport',[sys,'/',['Binary sequence',13,'convolution encode/in_1']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/in_1']],...
		'position',[55,25,75,45])


%     Subsystem  ['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time'].

new_system([sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']],'Location',[55,192,283,286])

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

add_block('built-in/Outport',[sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time/Outport']])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time/Outport']],...
		'position',[160,35,180,55])
add_line([sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']],[110,45;155,45])
set_param([sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']],...
		'Mask Display','Vector\nPulse',...
		'Mask Type','Pulse generator')
set_param([sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']],...
		'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,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']],...
		'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;')
set_param([sys,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']],...
		'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,'/',['Binary sequence',13,'convolution encode/Pulses deivide',13,'same sample time']],...
		'Mask Entries','samp*k\/[k, n]\/[0 0]\/')

⌨️ 快捷键说明

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