📄 msk.m
字号:
function [ret,x0,str,ts,xts]=msk(t,x,u,flag);
%MSK is the M-file description of the SIMULINK system named MSK.
% The block-diagram can be displayed by typing: MSK.
%
% SYS=MSK(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 MSK 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 MSK with a FLAG of zero:
% [SIZES]=MSK([],[],[],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',[251,42,1260,321])
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', '.025')
set_param(sys,'Max step size', '.025')
set_param(sys,'Relative error','1')
set_param(sys,'Return vars', '')
% Subsystem 'Kanal'.
new_system([sys,'/','Kanal'])
set_param([sys,'/','Kanal'],'Location',[11,262,273,408])
% Subsystem ['Kanal/Gaussian noise',13,'generator'].
new_system([sys,'/',['Kanal/Gaussian noise',13,'generator']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],'Location',[22,119,370,243])
add_block('built-in/Outport',[sys,'/',['Kanal/Gaussian noise',13,'generator/out_1']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/out_1']],...
'position',[285,60,305,80])
add_block('built-in/Sum',[sys,'/',['Kanal/Gaussian noise',13,'generator/Sum']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Sum']],...
'position',[220,60,240,80])
add_block('built-in/Constant',[sys,'/',['Kanal/Gaussian noise',13,'generator/Constant']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Constant']],...
'Value','m',...
'position',[140,20,160,40])
add_block('built-in/White Noise',[sys,'/',['Kanal/Gaussian noise',13,'generator/Random',13,'Number']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Random',13,'Number']],...
'Seed','s',...
'position',[35,57,80,93])
add_block('built-in/State-Space',[sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'A','[]',...
'B','[]',...
'C','[]',...
'D','K',...
'Mask Display','K',...
'Mask Type','Matrix Gain',...
'Mask Dialogue','Matrix Gain.|Gain matrix:')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'Mask Translate','K = @1;',...
'Mask Help','Multiplies input vector by entered matrix to produce output vector (y=Au).',...
'Mask Entries','d\/')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator/Matrix',13,'Gain']],...
'position',[140,61,165,89])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[85,75;135,75])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[170,75;215,75])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[245,70;280,70])
add_line([sys,'/',['Kanal/Gaussian noise',13,'generator']],[165,30;190,30;190,65;215,65])
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Display','plot(0,0,100,100,x,y);Gaussian',...
'Mask Type','Gaussian noise generator')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Dialogue','Generate Gaussian distributed noise with\ngiven mean and variance value.|Mean value:|Variance (vector or matrix):|Initial seed:')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=srcsicon(3);')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Help','When the mean value and seed are vectors, the output of this block is a vector. The length of the vector is the same as the length of the mean value vector or the length of the seed. When the variance entry is a vector, the variance is a diagonal matrix.')
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'Mask Entries','m\/d\/s\/')
% Finished composite block ['Kanal/Gaussian noise',13,'generator'].
set_param([sys,'/',['Kanal/Gaussian noise',13,'generator']],...
'position',[25,48,105,92])
add_block('built-in/Sum',[sys,'/','Kanal/Sum'])
set_param([sys,'/','Kanal/Sum'],...
'position',[150,55,170,75])
add_block('built-in/Outport',[sys,'/','Kanal/out_1'])
set_param([sys,'/','Kanal/out_1'],...
'position',[200,55,220,75])
add_block('built-in/Inport',[sys,'/','Kanal/in_1'])
set_param([sys,'/','Kanal/in_1'],...
'position',[45,10,65,30])
add_line([sys,'/','Kanal'],[110,70;145,70])
add_line([sys,'/','Kanal'],[70,20;115,20;115,60;145,60])
add_line([sys,'/','Kanal'],[175,65;195,65])
set_param([sys,'/','Kanal'],...
'Mask Display','plot(0,0,100,100,x,y);AWGN',...
'Mask Type','AWGN channel, fixed parameter')
set_param([sys,'/','Kanal'],...
'Mask Dialogue','Additive white Gaussian noise channel\nwith fixed mean and variance.|Mean value:|Variance (std^2):|Initial Seed:',...
'Mask Translate','m=@1;d=@2;s=@3;[m,d,s]=gwnoise(m,d,s);[x,y]=chanicon;')
set_param([sys,'/','Kanal'],...
'Mask Help','This block adds white Gaussian noise to the input signal. The mean and the variance can be a scalar or vector with the same length as the input signal.',...
'Mask Entries','0\/0.001\/12345\/')
% Finished composite block 'Kanal'.
set_param([sys,'/','Kanal'],...
'position',[465,83,545,127])
% Subsystem 'Error rate'.
new_system([sys,'/','Error rate'])
set_param([sys,'/','Error rate'],'Location',[255,368,509,510])
add_block('built-in/S-Function',[sys,'/','Error rate/S-function'])
set_param([sys,'/','Error rate/S-function'],...
'function name','sbiterr',...
'parameters','num_lin, K, TDelay, Sample',...
'position',[130,52,195,78])
add_block('built-in/Mux',[sys,'/','Error rate/Mux'])
set_param([sys,'/','Error rate/Mux'],...
'inputs','2',...
'position',[65,46,100,79])
add_block('built-in/Inport',[sys,'/','Error rate/in_1'])
set_param([sys,'/','Error rate/in_1'],...
'position',[15,45,35,65])
add_block('built-in/Inport',[sys,'/','Error rate/in_2'])
set_param([sys,'/','Error rate/in_2'],...
'Port','2',...
'position',[15,60,35,80])
add_line([sys,'/','Error rate'],[105,65;125,65])
add_line([sys,'/','Error rate'],[40,55;60,55])
add_line([sys,'/','Error rate'],[40,70;60,70])
set_param([sys,'/','Error rate'],...
'Mask Display','Error\nmeter',...
'Mask Type','Symbol/bit error counter')
set_param([sys,'/','Error rate'],...
'Mask Dialogue','Use the input data from the 1st port as the reference signal to detect the number of errors and error rate of the 2nd signal.|Bit per symbol:|Number of digits on display:|Delay between 1st port and 2nd port:|Sample time (sec):')
set_param([sys,'/','Error rate'],...
'Mask Translate','K=@1;num_lin=@2;TDelay=@3;Sample=@4;')
set_param([sys,'/','Error rate'],...
'Mask Help','The signal from the first port must be a scalar. The second input port can be a vector with a delay to the first port signal. The comparison happens only at the sampling point.')
set_param([sys,'/','Error rate'],...
'Mask Entries','1\/10\/2\/1\/')
% Finished composite block 'Error rate'.
set_param([sys,'/','Error rate'],...
'orientation',1,...
'position',[465,215,545,255])
% Subsystem 'Signalraumkonstellation_'.
new_system([sys,'/','Signalraumkonstellation_'])
set_param([sys,'/','Signalraumkonstellation_'],'Location',[0,38,1264,980])
set_param([sys,'/','Signalraumkonstellation_'],...
'Mask Display','Signalraum\nKonstellation',...
'Mask Dialogue','eval(''figure''); eval(''modmap(''''psk'''',4)'')')
% Finished composite block 'Signalraumkonstellation_'.
set_param([sys,'/','Signalraumkonstellation_'],...
'BackGround',7,...
'hide name',0,...
'position',[55,15,140,51])
% Subsystem 'Doppelklick2'.
new_system([sys,'/','Doppelklick2'])
set_param([sys,'/','Doppelklick2'],'Location',[136,230,381,439])
set_param([sys,'/','Doppelklick2'],...
'Mask Display','Zeige Sender',...
'Mask Type','鰂fnen')
set_param([sys,'/','Doppelklick2'],...
'Mask Dialogue','eval(''open_system(''''msk/Sender'''');open_system(''''msk/Sender/u(t)'''');open_system(''''msk/Sender/a(t)'''');open_system(''''msk/Sender/x_I(t)'''');open_system(''''msk/Sender/s_I(t)'''');open_system(''''msk/Sender/x_Q(t)'''');open_system(''''msk/Sender/s_Q(t)'''');open_system(''''msk/Sender/s(t)'''');open_system(''''msk/Sender/phi(t)'''')'')')
% Finished composite block 'Doppelklick2'.
set_param([sys,'/','Doppelklick2'],...
'BackGround',7,...
'hide name',0,...
'Font Angle','italic',...
'position',[30,85,165,111])
% Subsystem 'Doppelklick3'.
new_system([sys,'/','Doppelklick3'])
set_param([sys,'/','Doppelklick3'],'Location',[136,230,381,439])
set_param([sys,'/','Doppelklick3'],...
'Mask Display','Zeige Empf鋘ger',...
'Mask Type','鰂fnen')
set_param([sys,'/','Doppelklick3'],...
'Mask Dialogue','eval(''open_system(''''msk/Empf鋘ger'''');open_system(''''msk/Empf鋘ger/r(t)'''');open_system(''''msk/Empf鋘ger/x_eI(t)'''');open_system(''''msk/Empf鋘ger/d_eI(t)'''');open_system(''''msk/Empf鋘ger/x_eQ(t)'''');open_system(''''msk/Empf鋘ger/d_eQ(t)'''');open_system(''''msk/Empf鋘ger/y(t)'''');open_system(''''msk/Empf鋘ger/v(t)'''');'')')
% Finished composite block 'Doppelklick3'.
set_param([sys,'/','Doppelklick3'],...
'BackGround',7,...
'hide name',0,...
'Font Angle','italic',...
'position',[800,85,935,111])
add_block('built-in/Scope',[sys,'/','u(t)'])
set_param([sys,'/','u(t)'],...
'orientation',3,...
'move name',0,...
'Vgain','3.000000',...
'Hgain','12.500000',...
'Vmax','6.000000',...
'Hmax','25.000000',...
'Window',[360,340,1280,440])
open_system([sys,'/','u(t)'])
set_param([sys,'/','u(t)'],...
'position',[320,25,350,55])
add_block('built-in/Scope',[sys,'/','d_e(t)'])
set_param([sys,'/','d_e(t)'],...
'orientation',3,...
'move name',0,...
'Vgain','3.000000',...
'Hgain','12.500000',...
'Vmax','6.000000',...
'Hmax','25.000000',...
'Window',[360,740,1280,840])
open_system([sys,'/','d_e(t)'])
set_param([sys,'/','d_e(t)'],...
'position',[750,20,780,50])
% Subsystem 'Empf鋘ger'.
new_system([sys,'/','Empf鋘ger'])
set_param([sys,'/','Empf鋘ger'],'Location',[251,42,1259,320])
add_block('built-in/Inport',[sys,'/',['Empf鋘ger/gest鰎tes',13,'MSK-',13,'Signal']])
set_param([sys,'/',['Empf鋘ger/gest鰎tes',13,'MSK-',13,'Signal']],...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -