📄 bpsnrzmf.m
字号:
function [ret,x0,str,ts,xts]=bpsnrzmf(t,x,u,flag);
%BPSNRZMF is the M-file description of the SIMULINK system named BPSNRZMF.
% The block-diagram can be displayed by typing: BPSNRZMF.
%
% SYS=BPSNRZMF(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 BPSNRZMF 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 BPSNRZMF with a FLAG of zero:
% [SIZES]=BPSNRZMF([],[],[],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',[189,42,1254,319])
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.000001')
set_param(sys,'Max step size', '.01')
set_param(sys,'Relative error','1e-6')
set_param(sys,'Return vars', '')
% Subsystem 'Error rate'.
new_system([sys,'/','Error rate'])
set_param([sys,'/','Error rate'],'Location',[255,368,509,510])
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_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/Mux',[sys,'/','Error rate/Mux'])
set_param([sys,'/','Error rate/Mux'],...
'inputs','2',...
'position',[65,46,100,79])
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_line([sys,'/','Error rate'],[40,70;60,70])
add_line([sys,'/','Error rate'],[40,55;60,55])
add_line([sys,'/','Error rate'],[105,65;125,65])
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\/1\/1\/')
% Finished composite block 'Error rate'.
set_param([sys,'/','Error rate'],...
'orientation',1,...
'position',[890,230,970,270])
add_block('built-in/Scope',[sys,'/','u(t)'])
set_param([sys,'/','u(t)'],...
'move name',0,...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[344,338,1279,438])
open_system([sys,'/','u(t)'])
set_param([sys,'/','u(t)'],...
'position',[80,200,110,230])
add_block('built-in/S-Function',[sys,'/',['Integrate and Dump',13,'']])
set_param([sys,'/',['Integrate and Dump',13,'']],...
'function name','schdint',...
'parameters','td, ts, limit',...
'Mask Display','Scheduled\nreset-int',...
'Mask Type','Scheduled reset integration')
set_param([sys,'/',['Integrate and Dump',13,'']],...
'Mask Dialogue','Reset the state to be zero(s) at the\nscheduled reset sample point.|Scheduled reset time interval and offset (sec):|Computation sample time and offset (sec):|Modulo bound:')
set_param([sys,'/',['Integrate and Dump',13,'']],...
'Mask Translate','td=@1;ts=@2;limit=@3;')
set_param([sys,'/',['Integrate and Dump',13,'']],...
'Mask Help','This block resets the state(s) to be zero(s) at the reset time points. The reset interval can be a two-element vector with the second element as offset. The computation sample time must be smaller than the reset interval. The block resets the state value to be the remainder of the state divided by the modulo bound when the absolute value of the state is larger than the modulo bound.')
set_param([sys,'/',['Integrate and Dump',13,'']],...
'Mask Entries','1\/.01\/999\/',...
'position',[720,103,800,147])
% Subsystem 'Signalraumkonstellation_'.
new_system([sys,'/','Signalraumkonstellation_'])
set_param([sys,'/','Signalraumkonstellation_'],'Location',[4,78,139,166])
set_param([sys,'/','Signalraumkonstellation_'],...
'Mask Display','Signalraum\nKonstellation',...
'Mask Dialogue','eval(''figure''); eval(''modmap(''''psk'''',2)'')')
% Finished composite block 'Signalraumkonstellation_'.
set_param([sys,'/','Signalraumkonstellation_'],...
'BackGround',7,...
'hide name',0,...
'position',[20,19,105,56])
add_block('built-in/Scope',[sys,'/','x_e(t)'])
set_param([sys,'/','x_e(t)'],...
'orientation',1,...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[342,727,1278,827])
open_system([sys,'/','x_e(t)'])
set_param([sys,'/','x_e(t)'],...
'position',[675,180,705,210])
add_block('built-in/Scope',[sys,'/','x(t)'])
set_param([sys,'/','x(t)'],...
'orientation',1,...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[344,436,1279,536])
open_system([sys,'/','x(t)'])
set_param([sys,'/','x(t)'],...
'position',[175,200,205,230])
% Subsystem 'Quelle'.
new_system([sys,'/','Quelle'])
set_param([sys,'/','Quelle'],'Location',[4,149,283,322])
add_block('built-in/Fcn',[sys,'/','Quelle/Fcn'])
set_param([sys,'/','Quelle/Fcn'],...
'Expr','1-2*u',...
'position',[160,75,200,95])
add_block('built-in/Outport',[sys,'/','Quelle/out_1'])
set_param([sys,'/','Quelle/out_1'],...
'position',[230,75,250,95])
% Subsystem 'Quelle/Quelle'.
new_system([sys,'/','Quelle/Quelle'])
set_param([sys,'/','Quelle/Quelle'],'Location',[355,528,737,675])
% Subsystem ['Quelle/Quelle/Pulses deivide',13,'same sample time1'].
new_system([sys,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1']])
set_param([sys,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1']],'Location',[55,192,283,286])
add_block('built-in/S-Function',[sys,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1/S-function1']])
set_param([sys,'/',['Quelle/Quelle/Pulses deivide',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,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1/Outport']])
set_param([sys,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1/Outport']],...
'position',[160,35,180,55])
add_line([sys,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1']],[110,45;155,45])
set_param([sys,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1']],...
'Mask Display','Vector\nPulse',...
'Mask Type','Pulse generator')
set_param([sys,'/',['Quelle/Quelle/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,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1']],...
'Mask Translate','samp_time=@1;out_divid=@2;offset=@3;')
set_param([sys,'/',['Quelle/Quelle/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,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1']],...
'Mask Entries','ts\/1\/off\/')
% Finished composite block ['Quelle/Quelle/Pulses deivide',13,'same sample time1'].
set_param([sys,'/',['Quelle/Quelle/Pulses deivide',13,'same sample time1']],...
'position',[50,56,110,94])
add_block('built-in/Outport',[sys,'/','Quelle/Quelle/out_1'])
set_param([sys,'/','Quelle/Quelle/out_1'],...
'position',[295,65,315,85])
add_block('built-in/S-Function',[sys,'/','Quelle/Quelle/Message source'])
set_param([sys,'/','Quelle/Quelle/Message source'],...
'BackGround',5,...
'function name','trigwksp',...
'parameters','var,thd,cyclFlag,ini',...
'Mask Display','Triggered\nread',...
'Mask Type','Read from workspace')
set_param([sys,'/','Quelle/Quelle/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,'/','Quelle/Quelle/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,'/','Quelle/Quelle/Message source'],...
'Mask Entries','var\/.1\/cyc\/ini\/',...
'position',[180,53,255,97])
add_line([sys,'/','Quelle/Quelle'],[260,75;290,75])
add_line([sys,'/','Quelle/Quelle'],[115,75;175,75])
set_param([sys,'/','Quelle/Quelle'],...
'Mask Display','plot(0,0,100,100,x,y);Rd wksp',...
'Mask Type','Read from workspace')
set_param([sys,'/','Quelle/Quelle'],...
'Mask Dialogue','Read from a workspace variable at\nsampling time point.|Variable (column_number=block_output_length):|Data output sample time (sec):|Repeat flag (1: repeat read, 0: output zeros after eof).|Initial output:')
set_param([sys,'/','Quelle/Quelle'],...
'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,'/','Quelle/Quelle'],...
'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 reaches the end of the variable (eof), the block will cyclically output from the first row of the variable or output zeros based on the repeat flag entree.')
set_param([sys,'/','Quelle/Quelle'],...
'Mask Entries','randint(1000,1,2)\/1\/1\/1\/')
% Finished composite block 'Quelle/Quelle'.
set_param([sys,'/','Quelle/Quelle'],...
'position',[75,63,140,107])
add_line([sys,'/','Quelle'],[145,85;155,85])
add_line([sys,'/','Quelle'],[205,85;225,85])
% Finished composite block 'Quelle'.
set_param([sys,'/','Quelle'],...
'position',[10,98,40,152])
add_block('built-in/Clock',[sys,'/','Clock'])
set_param([sys,'/','Clock'],...
'hide name',0,...
'position',[235,150,255,170])
add_block('built-in/Fcn',[sys,'/','Fcn1'])
set_param([sys,'/','Fcn1'],...
'hide name',0,...
'Expr','cos(4*pi*u)',...
'position',[275,145,370,175])
add_block('built-in/Product',[sys,'/','Product'])
set_param([sys,'/','Product'],...
'hide name',0,...
'position',[400,118,430,142])
add_block('built-in/Scope',[sys,'/','Sendesignal s(t)'])
set_param([sys,'/','Sendesignal s(t)'],...
'orientation',1,...
'Vgain','2.000000',...
'Hgain','25.000000',...
'Vmax','4.000000',...
'Hmax','50.000000',...
'Window',[343,533,1279,633])
open_system([sys,'/','Sendesignal s(t)'])
set_param([sys,'/','Sendesignal s(t)'],...
'position',[445,180,475,210])
% Subsystem 'Kanal'.
new_system([sys,'/','Kanal'])
set_param([sys,'/','Kanal'],'Location',[11,262,273,408])
add_block('built-in/Inport',[sys,'/','Kanal/in_1'])
set_param([sys,'/','Kanal/in_1'],...
'position',[45,10,65,30])
add_block('built-in/Outport',[sys,'/','Kanal/out_1'])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -