📄 expd.m
字号:
function zx=expd(x,n)
%EXPD Expand a vector by repeating its points
% EXPD(X,n) expands the vector X to n times
% its length by repeating each point in X n times.
% This utility is used by FCOMP.
%
% It is also useful for simulating the output of a continuous
% system which is driven by a sampled data system.
% Having simulated the closed loop system at the sample times
% the sampled input to the continuous system is passed through
% EXPD and then used as the input U to LSIM to simulate the
% continuous response of the continuous system.
% The time step for LSIM is Ts/n , the sample time / n.
% See also COMP
% Dr M.P. Ford 20th August 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd
if (n<=0)|(rem(n,1)~=0)
error('N not a positive integer');
end
[mx,nx]=size(x);
if min(mx,nx)~=1
error('Input to be expanded not a vector');
end
if mx==1
zx=zeros(1,length(x)*n);
else
zx=zeros(length(x)*n,1);
end
k=0:n:(length(x)-1)*n;
for i=1:n
zx(k+i)=x;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -