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

📄 corrdemo.m

📁 本书是电子通信类的本科、研究生辅助教材
💻 M
字号:
function [ret,x0,str]=corrdemo(t,x,u,flag);
%CORRDEMO	is the M-file description of the SIMULINK system named CORRDEMO.
%	The block-diagram can be displayed by typing: CORRDEMO.
%
%	SYS=CORRDEMO(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 CORRDEMO 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 CORRDEMO with a FLAG of zero:
%	[SIZES]=CORRDEMO([],[],[],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',[71,115,413,286])
     open_system(sys)
end;
set_param(sys,'algorithm',		'Euler')
set_param(sys,'Start time',	'0.0')
set_param(sys,'Stop time',		'200')
set_param(sys,'Min step size',	'1e16')
set_param(sys,'Max step size',	'1e16')
set_param(sys,'Relative error','1e-3')
set_param(sys,'Return vars',	'')

add_block('built-in/Signal Generator',[sys,'/','Input signal'])
set_param([sys,'/','Input signal'],...
		'Peak','1.000000',...
		'Peak Range','2.272727',...
		'Freq','3.000000',...
		'Freq Range','23.076923',...
		'Wave','Saw',...
		'Units','Rads',...
		'position',[70,43,115,77])


%     Subsystem  'Auto correlator'.

new_system([sys,'/','Auto correlator'])
set_param([sys,'/','Auto correlator'],'Location',[0,0,287,181])

add_block('built-in/S-function',[sys,'/',['Auto correlator/S-function block',13,'which calls M-file']])
set_param([sys,'/',['Auto correlator/S-function block',13,'which calls M-file']],...
		'function name','sfuncorr',...
		'parameters','npts,HowOften,offset,ts,0,''unbiased''',...
		'position',[160,48,225,82])

add_block('built-in/Inport',[sys,'/','Auto correlator/input signal'])
set_param([sys,'/','Auto correlator/input signal'],...
		'position',[50,55,70,75])
add_line([sys,'/','Auto correlator'],[75,65;150,65])
set_param([sys,'/','Auto correlator'],...
		'Mask Display','plot(0,0,100,100,[11,93,93,11,11],[90,90,40,40,90],[80,60,40,20],[50,79,50,80])',...
		'Mask Type','Autocorrelator.')
set_param([sys,'/','Auto correlator'],...
		'Mask Dialogue','Auto correlator using graph window.|Length of buffer:|Plot after how many points:|Sample time:')
set_param([sys,'/','Auto correlator'],...
		'Mask Translate','npts=@1; HowOften=@2; ts=@3(1); if length(@3) > 1, offset = @3(2), else, offset = 0; end')
set_param([sys,'/','Auto correlator'],...
		'Mask Help','This block when hooked to the output of a system displays the auto correlation of the buffer in the graph window. For more see the M-file autocorr.',...
		'Mask Entries','100\/50\/0.1\/')


%     Finished composite block 'Auto correlator'.

set_param([sys,'/','Auto correlator'],...
		'position',[205,40,235,80])

add_block('built-in/Note',[sys,'/',['Warning: Signal Processing Toolbox is required for',13,'correlation blocks.']])
set_param([sys,'/',['Warning: Signal Processing Toolbox is required for',13,'correlation blocks.']],...
		'position',[170,115,171,116])
add_line(sys,[120,60;195,60])

% 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 + -