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

📄 fput.m

📁 控制系统计算机辅助设计——MATLAB语言与应用(源代码)
💻 M
字号:
function fout=fput(w,f,elements,index)
%FPUT   Replace elements in MVFR matrix
%       FPUT(W,F,ELEMENTS,INDEX) replaces elements in F, the
%       MVFR matrix, with the elements specified in the
%       columns of ELEMENTS, at the positions specified by
%       INDEX.
%       INDEX is a two column matrix whose rows specify
%       the elements to be replaced.
%       W is the associated frequency vector.
%
%       The number of rows of INDEX must equal the
%       number of columns of ELEMENTS.
%       The number of row of ELEMENTS must equal the
%       length of W.
%       See also FGET,FGETF

%       Dr M.P. Ford 4th August 1987
% Copyright (c) 1987 by GEC Engineering Research Centre & Cambridge Control Ltd

error(nargchk(4,4,nargin));
[m,n]=fsize(w,f);
[me,ne]=size(elements);
[mi,ni]=size(index);
lw=length(w);
if ni~=2
   error('Wrong number of columns in Index array')
end
if any(index(:,1)>m)|any(index(:,2)>n)
   error('Index out of range')
end
if lw~=me
   error('Number of rows of ELEMENTS not equal to length of freq. vector');
end
if mi~=ne
   error('Number of columns of ELEMENTS not equal to rows of INDEX');
end
fout=f;
for i=1:lw        % for each frequency
  for j=1:ne     % for each column of ELEMENTS
    fout((i-1)*m+index(j,1),index(j,2))=elements(i,j);
  end
end

⌨️ 快捷键说明

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