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

📄 linear.m

📁 本书是电子通信类的本科、研究生辅助教材
💻 M
字号:
function [ret,x0,str]=linear(t,x,u,flag);
%LINEAR	is the M-file description of the SIMULINK system named LINEAR.
%	The block-diagram can be displayed by typing: LINEAR.
%
%	SYS=LINEAR(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 LINEAR to return state derivitives, FLAG=2
%	discrete states, FLAG=3 system outputs and FLAG=4 next sample
%	time. For more information and other options see SFUNC.
%
%	Calling LINEAR with a FLAG of zero:
%	[SIZES]=LINEAR([],[],[],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.
%	For the definition of other parameters in SIZES, see SFUNC.
%	See also, TRIM, LINMOD, LINSIM, EULER, RK23, RK45, ADAMS, GEAR.

%	Copyright (c) 1990-94 by The MathWorks, Inc.

% 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',[0,56,378,544])
     open_system(sys)
end;
set_param(sys,'algorithm',		'Euler')
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',	'.1')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',	'')

add_block('built-in/Sum',[sys,'/','Sum'])
set_param([sys,'/','Sum'],...
		'position',[225,64,245,91])

add_block('built-in/Transfer Fcn',[sys,'/','Transfer Fcn'])
set_param([sys,'/','Transfer Fcn'],...
		'Numerator','[1 1]',...
		'Denominator','[1 1 0]',...
		'position',[145,210,225,260])

add_block('built-in/Derivative',[sys,'/','Derivative'])
set_param([sys,'/','Derivative'],...
		'position',[165,440,205,460])

add_block('built-in/Integrator',[sys,'/','Integrator'])
set_param([sys,'/','Integrator'],...
		'position',[170,165,200,185])

add_block('built-in/Gain',[sys,'/','Gain'])
set_param([sys,'/','Gain'],...
		'position',[140,105,170,135])

add_block('built-in/Note',[sys,'/','Library'])
set_param([sys,'/','Library'],...
		'position',[185,30,186,31])

add_block('built-in/Note',[sys,'/','Linear'])
set_param([sys,'/','Linear'],...
		'position',[185,10,186,11])

add_block('built-in/Signal Generator',[sys,'/',['Signal ',13,'Generator']])
set_param([sys,'/',['Signal ',13,'Generator']],...
		'Peak','1.000000',...
		'Peak Range','1.000000',...
		'Freq','1.000000',...
		'Freq Range','1.000000',...
		'Wave','Sin',...
		'Units','Rads',...
		'position',[25,218,70,252])

add_block('built-in/Zero-Pole',[sys,'/','Zero-Pole'])
set_param([sys,'/','Zero-Pole'],...
		'Zeros','[-1]',...
		'Poles','[-5 0]',...
		'position',[150,365,220,415])

add_block('built-in/State-space',[sys,'/','State-space'])
set_param([sys,'/','State-space'],...
		'A','-1',...
		'D','0',...
		'X0','0',...
		'position',[145,290,225,340])

add_block('built-in/Scope',[sys,'/','SS Scope'])
set_param([sys,'/','SS Scope'],...
		'Vgain','1.000000',...
		'Hgain','10.000000',...
		'Vmax','2.000000',...
		'Hmax','20.000000',...
		'Window',[399,342,627,467],...
		'position',[290,302,310,328])

add_block('built-in/Scope',[sys,'/','ZP Scope'])
set_param([sys,'/','ZP Scope'],...
		'Vgain','1.000000',...
		'Hgain','10.000000',...
		'Vmax','2.000000',...
		'Hmax','20.000000',...
		'Window',[401,419,624,542],...
		'position',[290,377,310,403])

add_block('built-in/Scope',[sys,'/','Derivative Scope'])
set_param([sys,'/','Derivative Scope'],...
		'Vgain','1.500000',...
		'Hgain','10.000000',...
		'Vmax','2.000000',...
		'Hmax','20.000000',...
		'Window',[402,479,631,598],...
		'position',[290,437,310,463])

add_block('built-in/Scope',[sys,'/','TF Scope'])
set_param([sys,'/','TF Scope'],...
		'Vgain','6.000000',...
		'Hgain','10.000000',...
		'Vmax','12.000000',...
		'Hmax','20.000000',...
		'Window',[402,277,637,408],...
		'position',[290,222,310,248])

add_block('built-in/Scope',[sys,'/','Integrator Scope'])
set_param([sys,'/','Integrator Scope'],...
		'Vgain','3.000000',...
		'Hgain','10.000000',...
		'Vmax','6.000000',...
		'Hmax','20.000000',...
		'Window',[395,203,623,333],...
		'position',[290,162,310,188])

add_block('built-in/Scope',[sys,'/','Sum Scope'])
set_param([sys,'/','Sum Scope'],...
		'Vgain','3.000000',...
		'Hgain','10.000000',...
		'Vmax','6.000000',...
		'Hmax','20.000000',...
		'Window',[392,131,617,259],...
		'position',[290,67,310,93])
add_line(sys,[230,235;280,235])
add_line(sys,[230,315;280,315])
add_line(sys,[225,390;280,390])
add_line(sys,[210,450;280,450])
add_line(sys,[250,80;280,80])
add_line(sys,[205,175;280,175])
add_line(sys,[175,120;195,120;195,85;215,85])
add_line(sys,[75,235;75,175;160,175])
add_line(sys,[75,235;75,450;155,450])
add_line(sys,[75,235;75,390;140,390])
add_line(sys,[75,235;75,315;135,315])
add_line(sys,[75,235;75,120;130,120])
add_line(sys,[75,235;75,70;215,70])
add_line(sys,[75,235;135,235])
% Return any arguments.
if (nargin | nargout)
	% Must use feval here to access system in memory
	if (nargin > 3)
		if (flag == 0)
			eval(['[ret,x0,str]=',sys,'(t,x,u,flag);'])
		else
			eval(['ret =', sys,'(t,x,u,flag);'])
		end
	else
		[ret,x0,str] = feval(sys);
	end
end

⌨️ 快捷键说明

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