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

📄 v34struc.m

📁 通信系统的matlab仿真程序
💻 M
📖 第 1 页 / 共 5 页
字号:
function [ret,x0,str,ts,xts]=v34struc(t,x,u,flag);
%V34STRUC	is the M-file description of the SIMULINK system named V34STRUC.
%	The block-diagram can be displayed by typing: V34STRUC.
%
%	SYS=V34STRUC(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 V34STRUC 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 V34STRUC with a FLAG of zero:
%	[SIZES]=V34STRUC([],[],[],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',[142,99,723,354])
     open_system(sys)
end;
set_param(sys,'algorithm',     'RK-45')
set_param(sys,'Start time',    '0.0')
set_param(sys,'Stop time',     '2.8')
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',   '')
set_param(sys,'Load callback','v34cod16;BRATE=28800;SRATE=3200;CON_CODE=1;v34_plot_flag=0;v34_rate_b = 72; v34_rate_p=7;v34_rate_j=16;v34struc;');

add_block('built-in/Note',[sys,'/','V.34 Modem Data Transmission'])
set_param([sys,'/','V.34 Modem Data Transmission'],...
		'ForeGround',2,...
		'Font Weight','bold',...
		'Font Size',12,...
		'position',[270,25,275,30])

add_block('built-in/Constant',[sys,'/','Enable signal2'])
set_param([sys,'/','Enable signal2'],...
		'position',[350,115,370,135])

add_block('built-in/Constant',[sys,'/','Enable signal1'])
set_param([sys,'/','Enable signal1'],...
		'position',[45,105,65,125])


%     Subsystem  'Call modem'.

new_system([sys,'/','Call modem'])
set_param([sys,'/','Call modem'],'Location',[169,449,1021,789])

add_block('built-in/S-Function',[sys,'/',['Call modem/Integer vector',13,'to scalar']])
set_param([sys,'/',['Call modem/Integer vector',13,'to scalar']],...
		'ForeGround',3,...
		'hide name',0,...
		'function name','simbi2de',...
		'parameters','p',...
		'Mask Display','Vec to sca\nconverter')
set_param([sys,'/',['Call modem/Integer vector',13,'to scalar']],...
		'Mask Type','Base M vector to decimal integer')
set_param([sys,'/',['Call modem/Integer vector',13,'to scalar']],...
		'Mask Dialogue','Convert base M integer with each\nposition in the input vector into scalar decimal output.|Input integer base M:',...
		'Mask Translate','p=@1;')
set_param([sys,'/',['Call modem/Integer vector',13,'to scalar']],...
		'Mask Help','This block convert the base M vector into scalar decimal integer output. Each element of the input vector is one position of the digit of the base M integer. The 1st element in the input vector contains the 1''s position. The 2nd element in the input vector contains the M''s position.')
set_param([sys,'/',['Call modem/Integer vector',13,'to scalar']],...
		'Mask Entries','2\/',...
		'position',[240,18,320,62])


%     Subsystem  ['Call modem/Triggered',13,'signal switch'].

new_system([sys,'/',['Call modem/Triggered',13,'signal switch']])
set_param([sys,'/',['Call modem/Triggered',13,'signal switch']],'Location',[624,516,1004,680])

add_block('built-in/Inport',[sys,'/',['Call modem/Triggered',13,'signal switch/in_1']])
set_param([sys,'/',['Call modem/Triggered',13,'signal switch/in_1']],...
		'position',[65,20,85,40])

add_block('built-in/Mux',[sys,'/',['Call modem/Triggered',13,'signal switch/Mux']])
set_param([sys,'/',['Call modem/Triggered',13,'signal switch/Mux']],...
		'inputs','2',...
		'position',[145,54,175,96])

add_block('built-in/Outport',[sys,'/',['Call modem/Triggered',13,'signal switch/out_1']])
set_param([sys,'/',['Call modem/Triggered',13,'signal switch/out_1']],...
		'position',[320,65,340,85])

add_block('built-in/Inport',[sys,'/',['Call modem/Triggered',13,'signal switch/in_2']])
set_param([sys,'/',['Call modem/Triggered',13,'signal switch/in_2']],...
		'Port','2',...
		'position',[60,75,80,95])

add_block('built-in/S-Function',[sys,'/',['Call modem/Triggered',13,'signal switch/S-function']])
set_param([sys,'/',['Call modem/Triggered',13,'signal switch/S-function']],...
		'function name','stdmamux',...
		'parameters','sw,ke,in,tt',...
		'position',[205,60,275,90])
add_line([sys,'/',['Call modem/Triggered',13,'signal switch']],[90,30;120,30;120,65;140,65])
add_line([sys,'/',['Call modem/Triggered',13,'signal switch']],[85,85;140,85])
add_line([sys,'/',['Call modem/Triggered',13,'signal switch']],[180,75;200,75])
add_line([sys,'/',['Call modem/Triggered',13,'signal switch']],[280,75;315,75])
set_param([sys,'/',['Call modem/Triggered',13,'signal switch']],...
		'Mask Display','plot(0,0,100,100,v,w);Vct re-arr',...
		'Mask Type','Vector signal re-distribution')
set_param([sys,'/',['Call modem/Triggered',13,'signal switch']],...
		'Mask Dialogue','The rising edge from the 2nd inport\ntriggers the output of this block to follow the rule of the next row in the switch box.|Switch box (column number equals block output length):|Keeping value (flag 0 element in switch box):|Initial value (before the 1st trigger is detected):|Trigger threshold:')
set_param([sys,'/',['Call modem/Triggered',13,'signal switch']],...
		'Mask Translate','sw=@1;ke=@2;in=@3;tt=@4;[v,w]=trigicon(0,25,get_param(gcb,''orientation''),2);')
set_param([sys,'/',['Call modem/Triggered',13,'signal switch']],...
		'Mask Help','When the ith element in the current row of the switch box is j, the ith element in the output vector equals jth input element. When j=0, the output keeps the last output value if keep_value >= 0; it equals ini_val otherwise. The switch box column number must be same as the lengths of output, keep_value, and init_value. The rising edge of the 2nd inport triggers the distribution pattern to follow the next row of the switch box.')
set_param([sys,'/',['Call modem/Triggered',13,'signal switch']],...
		'Mask Entries','vec2mat([1:b],ceil(b/4))\/zeros(1,ceil(b/4))\/zeros(1,ceil(b/4))\/.1\/')


%     Finished composite block ['Call modem/Triggered',13,'signal switch'].

set_param([sys,'/',['Call modem/Triggered',13,'signal switch']],...
		'ForeGround',3,...
		'hide name',0,...
		'position',[140,18,220,62])

add_block('built-in/Outport',[sys,'/','Call modem/input binary'])
set_param([sys,'/','Call modem/input binary'],...
		'ForeGround',3,...
		'Port','2',...
		'position',[355,30,375,50])

add_block('built-in/Note',[sys,'/','Call modem/Uo(m)'])
set_param([sys,'/','Call modem/Uo(m)'],...
		'ForeGround',2,...
		'position',[660,235,665,240])


%     Subsystem  ['Call modem/QAM',13,'baseband'].

new_system([sys,'/',['Call modem/QAM',13,'baseband']])
set_param([sys,'/',['Call modem/QAM',13,'baseband']],'Location',[335,197,968,490])

add_block('built-in/Note',[sys,'/',['Call modem/QAM',13,'baseband/R1']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/R1']],...
		'position',[190,15,195,20])

add_block('built-in/Product',[sys,'/',['Call modem/QAM',13,'baseband/Product']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/Product']],...
		'position',[300,33,330,57])

add_block('built-in/Product',[sys,'/',['Call modem/QAM',13,'baseband/Product1']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/Product1']],...
		'position',[300,93,330,117])

add_block('built-in/Sum',[sys,'/',['Call modem/QAM',13,'baseband/Sum']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/Sum']],...
		'inputs','+-',...
		'position',[375,60,395,80])

add_block('built-in/Note',[sys,'/',['Call modem/QAM',13,'baseband/R_out']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/R_out']],...
		'position',[445,45,450,50])

add_block('built-in/Mux',[sys,'/',['Call modem/QAM',13,'baseband/RI2C']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/RI2C']],...
		'inputs','2',...
		'Mask Display','Real/Imag\nto Complex',...
		'Mask Type','Real/Imag to Complex',...
		'Mask Dialogue','Construct complex vector from real and imaginary vectors.')
set_param([sys,'/',['Call modem/QAM',13,'baseband/RI2C']],...
		'Mask Help','The Real/Imag to Complex block creates a complex output from the two inputs. It uses a Mux block to append the complex part (input 2) to the real part (input 1).')
set_param([sys,'/',['Call modem/QAM',13,'baseband/RI2C']],...
		'position',[470,119,545,161])

add_block('built-in/Inport',[sys,'/',['Call modem/QAM',13,'baseband/in_1']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/in_1']],...
		'position',[95,30,115,50])

add_block('built-in/Outport',[sys,'/',['Call modem/QAM',13,'baseband/out_1']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/out_1']],...
		'position',[585,130,605,150])

add_block('built-in/Constant',[sys,'/',['Call modem/QAM',13,'baseband/Constant']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/Constant']],...
		'Value','x1',...
		'position',[80,145,100,165])

add_block('built-in/Constant',[sys,'/',['Call modem/QAM',13,'baseband/Constant1']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/Constant1']],...
		'Value','x2',...
		'position',[130,165,150,185])

add_block('built-in/Note',[sys,'/',['Call modem/QAM',13,'baseband/I1']])
set_param([sys,'/',['Call modem/QAM',13,'baseband/I1']],...
		'position',[193,43,198,48])

⌨️ 快捷键说明

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