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

📄 t2w.m

📁 控制系统计算机辅助设计——MATLAB语言与应用(源代码)
💻 M
字号:
function [w,t] = t2w(range,dt)
%T2W     Forms frequency vector for use with fimpulse and fstep.
%
%        [w,t] = t2w(range,dt)
%        [w,t] = t2w(range)
%            w = t2w(range,dt)
%            w = t2w(range)
%
% Forms frequency vector w for use with fimpulse and fstep, given
% the simulation range (time horizon), and the required resolution dt.
% The default resolution is range/1024.
% The second (optional) output argument is the vector
% of time points, which is useful when plotting time responses.
% The number of points in w is always (N/2)+1, where N is a 
% power of 2. The achieved resolution may be greater than that
% required.

% J.M.Maciejowski, 13 March 1988. Revised 1 June 1988, JMM.
% Copyright (C) Cambridge Control Ltd, 1988.

nargi = nargin; nargo = nargout;
nargchk(1,2,nargi);
nargchk(1,2,nargo);
if range<=0, 
  error('Range must be positive. (T2W)')
end

N = 1024; % Default
if nargi > 1,
  N = range/dt;
  N = 2^ceil(log(N)/log(2));
end

w = (0:2:N)*pi/range;

if nargo > 1,
  dt = range/(N-1);
  t = 0:dt:range; 
end

⌨️ 快捷键说明

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