📄 com_chan.m
字号:
function [ret,x0,str,ts,xts]=com_chan(t,x,u,flag);
%COM_CHAN is the M-file description of the SIMULINK system named COM_CHAN.
% The block-diagram can be displayed by typing: COM_CHAN.
%
% SYS=COM_CHAN(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 COM_CHAN 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 COM_CHAN with a FLAG of zero:
% [SIZES]=COM_CHAN([],[],[],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',[242,70,812,601])
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', '')
% Subsystem ['Rayleigh fading',13,'channel CE'].
new_system([sys,'/',['Rayleigh fading',13,'channel CE']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE']],'Location',[265,109,636,349])
add_block('built-in/Inport',[sys,'/',['Rayleigh fading',13,'channel CE/in_1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/in_1']],...
'position',[30,20,50,40])
add_block('built-in/Constant',[sys,'/',['Rayleigh fading',13,'channel CE/Constant']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Constant']],...
'Value','[in_p, -quad]',...
'position',[30,70,105,100])
% Subsystem ['Rayleigh fading',13,'channel CE/Inner',13,'Product'].
new_system([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']],'Location',[33,479,253,634])
add_block('built-in/Product',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/Product']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/Product']],...
'position',[65,55,90,75])
add_block('built-in/Sum',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/Sum']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/Sum']],...
'inputs','+',...
'position',[125,55,145,75])
add_block('built-in/Outport',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/out_1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/out_1']],...
'position',[185,55,205,75])
add_block('built-in/Inport',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/in_2']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/in_2']],...
'Port','2',...
'position',[15,90,35,110])
add_block('built-in/Inport',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/in_1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product/in_1']],...
'position',[15,25,35,45])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']],[40,100;60,70])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']],[40,35;60,60])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']],[95,65;120,65])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']],[150,65;180,65])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']],...
'Mask Display','.\n',...
'Mask Type','Dot Product',...
'Mask Dialogue','Inner (dot) product.\ny=sum(u1.*u2)')
set_param([sys,'/',['Rayleigh fading',13,'channel CE/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 ['Rayleigh fading',13,'channel CE/Inner',13,'Product'].
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product']],...
'position',[150,69,170,91])
add_block('built-in/Constant',[sys,'/',['Rayleigh fading',13,'channel CE/Constant1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Constant1']],...
'Value','[quad, in_p]',...
'position',[30,155,105,185])
% Subsystem ['Rayleigh fading',13,'channel CE/Inner',13,'Product1'].
new_system([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],'Location',[33,479,253,634])
add_block('built-in/Inport',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/in_1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/in_1']],...
'position',[15,25,35,45])
add_block('built-in/Inport',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/in_2']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/in_2']],...
'Port','2',...
'position',[15,90,35,110])
add_block('built-in/Outport',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/out_1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/out_1']],...
'position',[185,55,205,75])
add_block('built-in/Sum',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/Sum']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/Sum']],...
'inputs','+',...
'position',[125,55,145,75])
add_block('built-in/Product',[sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/Product']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1/Product']],...
'position',[65,55,90,75])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],[150,65;180,65])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],[95,65;120,65])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],[40,35;60,60])
add_line([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],[40,100;60,70])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],...
'Mask Display','.\n',...
'Mask Type','Dot Product',...
'Mask Dialogue','Inner (dot) product.\ny=sum(u1.*u2)')
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],...
'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 ['Rayleigh fading',13,'channel CE/Inner',13,'Product1'].
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Inner',13,'Product1']],...
'position',[150,154,170,176])
add_block('built-in/Mux',[sys,'/',['Rayleigh fading',13,'channel CE/Mux']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/Mux']],...
'inputs','2',...
'position',[220,116,255,149])
add_block('built-in/Outport',[sys,'/',['Rayleigh fading',13,'channel CE/out_1']])
set_param([sys,'/',['Rayleigh fading',13,'channel CE/out_1']],...
'position',[290,125,310,145])
add_line([sys,'/',['Rayleigh fading',13,'channel CE']],[55,30;120,30;120,75;145,75])
add_line([sys,'/',['Rayleigh fading',13,'channel CE']],[110,85;145,85])
add_line([sys,'/',['Rayleigh fading',13,'channel CE']],[110,170;145,170])
add_line([sys,'/',['Rayleigh fading',13,'channel CE']],[120,75;120,160;145,160])
add_line([sys,'/',['Rayleigh fading',13,'channel CE']],[175,80;190,80;190,125;215,125])
add_line([sys,'/',['Rayleigh fading',13,'channel CE']],[175,165;190,165;190,140;215,140])
add_line([sys,'/',['Rayleigh fading',13,'channel CE']],[260,135;285,135])
set_param([sys,'/',['Rayleigh fading',13,'channel CE']],...
'Mask Display','plot(0,0,100,100,x,y,v,w,u,z);Rayl F',...
'Mask Type','Rayleigh fading channel, fixed parameter')
set_param([sys,'/',['Rayleigh fading',13,'channel CE']],...
'Mask Dialogue','Rayleigh fading channel with fixed\nfading envelope and phase shift.|Rayleigh fading envelope:|Phase shift of the channel (rad):')
set_param([sys,'/',['Rayleigh fading',13,'channel CE']],...
'Mask Translate','a=@1;b=@2;in_p=a*cos(b);quad=a*sin(b);[x,y]=chanicon;[v,w]=cmplxicn(0,50,get_param(gcb,''orientation''));[u,z]=cmplxicn(1,50,get_param(gcb,''orientation''));')
set_param([sys,'/',['Rayleigh fading',13,'channel CE']],...
'Mask Help','This block applies the fading and phase shifting to the transmitting signal. In general, the fading envelope should be no larger than one. The input and the output of this block are both complex signals.')
set_param([sys,'/',['Rayleigh fading',13,'channel CE']],...
'Mask Entries','1\/0\/')
% Finished composite block ['Rayleigh fading',13,'channel CE'].
set_param([sys,'/',['Rayleigh fading',13,'channel CE']],...
'position',[325,78,405,122])
add_block('built-in/Note',[sys,'/','Baseband Channel'])
set_param([sys,'/','Baseband Channel'],...
'Font Name','Arial',...
'Font Size',11,...
'position',[430,40,435,45])
% Subsystem ['Rayleigh fading channel',13,'w vary para CE'].
new_system([sys,'/',['Rayleigh fading channel',13,'w vary para CE']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE']],'Location',[266,502,924,748])
add_block('built-in/Inport',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/in_3']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/in_3']],...
'Port','3',...
'position',[45,160,65,180])
add_block('built-in/Fcn',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Fcn']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Fcn']],...
'Expr','cos(u[1])',...
'position',[110,132,180,158])
add_block('built-in/Demux',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Demux']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Demux']],...
'outputs','2',...
'position',[140,15,180,50])
add_block('built-in/Inport',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/in_1']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/in_1']],...
'position',[75,25,95,45])
add_block('built-in/Product',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product']],...
'position',[300,20,325,40])
add_block('built-in/Fcn',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Fcn1']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Fcn1']],...
'position',[115,192,185,218])
add_block('built-in/Product',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product2']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product2']],...
'position',[300,130,325,150])
add_block('built-in/Product',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product3']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product3']],...
'position',[300,190,325,210])
add_block('built-in/Sum',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Sum']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Sum']],...
'inputs','+-',...
'position',[425,70,445,90])
add_block('built-in/Sum',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Sum1']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Sum1']],...
'position',[425,125,445,145])
add_block('built-in/Product',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product1']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Product1']],...
'position',[295,90,320,110])
add_block('built-in/Mux',[sys,'/',['Rayleigh fading channel',13,'w vary para CE/Mux']])
set_param([sys,'/',['Rayleigh fading channel',13,'w vary para CE/Mux']],...
'inputs','2',...
'position',[495,96,530,129])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -