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

📄 sampidr.m

📁 PLS_Toolbox是用于故障检测与诊断方面的matlab工具箱
💻 M
字号:
function [ii] = sampidr(x,y)
%SAMPIDR Identifies a sample on a 2D plot
%  SAMPIDR identifies a sample on a plot of y vs x
%  such as "plot(x,y,'o'). Inputs are (x) the vector
%  for the abscissa and (y) the vector the ordinate.
%  The input vectors must be the same length. When run
%  SAMPIDR will identify the indice (ii) of the sample
%  closest to the point where the mouse is clicked on
%  the plot.
%
%I/O: ii = sampidr(x,y);

%Copyright Eigenvector Research, Inc. 1996-98
%nbg

[mx,nx] = size(x);
[my,ny] = size(y);
if (mx>1&nx>1)|(my>1&ny>1)
  error('Inputs must be vectors')
end
if nx>mx
  x     = x';
  mx    = nx;
end
if ny>my
  y     = y';
  my    = ny;
end
if (mx~=my)
  error('Inputs must be same length')
end

w       = ginput(1);
v       = axis;
xd      = (x - w(ones(mx,1),1))/(v(2)-v(1));
yd      = (y - w(ones(mx,1),2))/(v(4)-v(3));
d       = [xd.^2 yd.^2];
[d,ii]  = min(sum(d')');

⌨️ 快捷键说明

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