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

📄 bpswnymf.m

📁 现代通信系统(prokis)的所有matlab源程序,对初学者很有帮助的。
💻 M
📖 第 1 页 / 共 5 页
字号:
function [ret,x0,str,ts,xts]=bpswnymf(t,x,u,flag);
%BPSWNYMF	is the M-file description of the SIMULINK system named BPSWNYMF.
%	The block-diagram can be displayed by typing: BPSWNYMF.
%
%	SYS=BPSWNYMF(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 BPSWNYMF 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 BPSWNYMF with a FLAG of zero:
%	[SIZES]=BPSWNYMF([],[],[],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',[194,42,1259,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', '10')
set_param(sys,'Relative error','1e-6')
set_param(sys,'Return vars',   '')

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',[210,205,240,235])

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',[85,205,115,235])


%     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\/12\/1\/')


%     Finished composite block 'Error rate'.

set_param([sys,'/','Error rate'],...
		'orientation',1,...
		'position',[890,230,970,270])


%     Subsystem  ['Schwellenwert-',13,'Entscheider'].

new_system([sys,'/',['Schwellenwert-',13,'Entscheider']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],'Location',[159,417,467,586])

add_block('built-in/Constant',[sys,'/',['Schwellenwert-',13,'Entscheider/Constant']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Constant']],...
		'Value','0',...
		'position',[65,105,85,125])

add_block('built-in/Relational Operator',[sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator1']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator1']],...
		'Operator','<',...
		'position',[140,92,170,123])

add_block('built-in/Sum',[sys,'/',['Schwellenwert-',13,'Entscheider/Sum']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Sum']],...
		'inputs','+-',...
		'position',[215,64,235,91])

add_block('built-in/Relational Operator',[sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/Relational',13,'Operator']],...
		'Operator','>',...
		'position',[140,32,170,63])

add_block('built-in/Inport',[sys,'/',['Schwellenwert-',13,'Entscheider/in_1']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/in_1']],...
		'position',[35,30,55,50])

add_block('built-in/Outport',[sys,'/',['Schwellenwert-',13,'Entscheider/out_1']])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider/out_1']],...
		'position',[265,70,285,90])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[240,80;260,80])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[175,50;185,50;185,70;210,70])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[175,110;185,110;185,85;210,85])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[90,115;135,115])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[110,115;110,55;135,55])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[60,40;135,40])
add_line([sys,'/',['Schwellenwert-',13,'Entscheider']],[95,40;95,100;135,100])
set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],...
		'Mask Display','plot(-50,-50,50,50,[-50,50],[0,0],[0,0],[-50,50],[-40,0],[-30,-30],[0,40],[30,30])',...
		'Mask Type','Sign',...
		'Mask Dialogue','y = sign(x)')
set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],...
		'Mask Help','Sign Function:\n\t\t\ty = 1 if x > 0\n\t\t\ty = 0 if x = 0\n\t\t\ty = -1 if x < 0')


%     Finished composite block ['Schwellenwert-',13,'Entscheider'].

set_param([sys,'/',['Schwellenwert-',13,'Entscheider']],...
		'position',[890,112,920,138])

add_block('built-in/Scope',[sys,'/','d_e(t)'])
set_param([sys,'/','d_e(t)'],...
		'orientation',1,...
		'Vgain','2.000000',...
		'Hgain','25.000000',...
		'Vmax','4.000000',...
		'Hmax','50.000000',...
		'Window',[341,824,1277,924])
open_system([sys,'/','d_e(t)'])
set_param([sys,'/','d_e(t)'],...
		'position',[830,180,860,210])

add_block('built-in/Product',[sys,'/','Product1'])
set_param([sys,'/','Product1'],...
		'hide name',0,...
		'position',[640,113,670,137])

add_block('built-in/Scope',[sys,'/','Senkensignal v(t)'])
set_param([sys,'/','Senkensignal v(t)'],...
		'Vgain','2.000000',...
		'Hgain','25.000000',...
		'Vmax','4.000000',...
		'Hmax','50.000000',...
		'Window',[341,922,1277,1022])
open_system([sys,'/','Senkensignal v(t)'])
set_param([sys,'/','Senkensignal v(t)'],...
		'position',[990,110,1020,140])

add_block('built-in/Scope',[sys,'/','Empfangssignal r(t)'])
set_param([sys,'/','Empfangssignal r(t)'],...
		'orientation',1,...
		'Vgain','2.000000',...
		'Hgain','25.000000',...
		'Vmax','4.000000',...
		'Hmax','50.000000',...
		'Window',[342,629,1278,729])
open_system([sys,'/','Empfangssignal r(t)'])
set_param([sys,'/','Empfangssignal r(t)'],...
		'position',[585,215,615,245])


%     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'])
set_param([sys,'/','Kanal/out_1'],...
		'position',[200,55,220,75])

add_block('built-in/Sum',[sys,'/','Kanal/Sum'])
set_param([sys,'/','Kanal/Sum'],...
		'position',[150,55,170,75])


%     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/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']],...

⌨️ 快捷键说明

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