at.m

来自「Matsig is an object-oriented signal clas」· M 代码 · 共 22 行

M
22
字号
function [idx] = at(y,xs)% [idx] = at(y,xs)  Return elements of y nearest to xs% AT is the inverse of the indexing paren operator. Ie,%% xs=y(idx) <=> idx=at(y,xs)%% AT can for instance be used to get the corresponding indexes from a% time vector:%% t=(0:fs-1)/fs;% idx=at(t,[0.5 0.6]);% $Id: at.m 3 2004-02-04 12:57:04Z mairas $idx=zeros(size(xs));for i=1:length(xs)  x=xs(i);  [C,idx(i)] = min(abs(y-x));end

⌨️ 快捷键说明

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