Datasheet 搜索 > ST Microelectronics(意法半导体) > IIS2MDCTR 数据手册 > IIS2MDCTR 产品描述及参数 5/6 页


¥ 11.919
IIS2MDCTR 产品描述及参数 - ST Microelectronics(意法半导体)
制造商:
ST Microelectronics(意法半导体)
封装:
LGA-12
描述:
板机接口霍耳效应/磁性传感器 High accuracy, ultra-low-power ,3-axis digital output magnetometer
Pictures:
3D模型
符号图
焊盘图
引脚图
产品图
IIS2MDCTR数据手册
Page:
of 6 Go
若手册格式错乱,请下载阅览PDF原文件

August 2016
DT0059 Rev 2
5/6
www.st.com
MatLab code for ellipsoid/sphere fitting
Reference implementation.
function [ofs,gain,rotM]=ellipsoid_fit(XYZ,varargin)
% Fit an (non)rotated ellipsoid or sphere to a set of xyz data points
% XYZ: N(rows) x 3(cols), matrix of N data points (x,y,z)
% optional flag f, default to 0 (fitting of rotated ellipsoid)
x=XYZ(:,1); y=XYZ(:,2); z=XYZ(:,3); if nargin>1, f=varargin{1}; else f=0; end;
if f==0, D=[x.*x, y.*y, z.*z, 2*x.*y,2*x.*z,2*y.*z, 2*x,2*y,2*z]; % any axes (rotated ellipsoid)
elseif f==1, D=[x.*x, y.*y, z.*z, 2*x,2*y,2*z]; % XYZ axes (non-rotated ellipsoid)
elseif f==2, D=[x.*x+y.*y, z.*z, 2*x,2*y,2*z]; % and radius x=y
elseif f==3, D=[x.*x+z.*z, y.*y, 2*x,2*y,2*z]; % and radius x=z
elseif f==4, D=[y.*y+z.*z, x.*x, 2*x,2*y,2*z]; % and radius y=z
elseif f==5, D=[x.*x+y.*y+z.*z, 2*x,2*y,2*z]; % and radius x=y=z (sphere)
end;
v = (D'*D)\(D'*ones(length(x),1)); % least square fitting
if f==0, % rotated ellipsoid
A = [ v(1) v(4) v(5) v(7); v(4) v(2) v(6) v(8); v(5) v(6) v(3) v(9); v(7) v(8) v(9) -1 ];
ofs=-A(1:3,1:3)\[v(7);v(8);v(9)]; % offset is center of ellipsoid
Tmtx=eye(4); Tmtx(4,1:3)=ofs'; AT=Tmtx*A*Tmtx'; % ellipsoid translated to (0,0,0)
[rotM ev]=eig(AT(1:3,1:3)/-AT(4,4)); % eigenvectors (rotation) and eigenvalues (gain)
gain=sqrt(1./diag(ev)); % gain is radius of the ellipsoid
else % non-rotated ellipsoid
if f==1, v = [ v(1) v(2) v(3) 0 0 0 v(4) v(5) v(6) ];
elseif f==2, v = [ v(1) v(1) v(2) 0 0 0 v(3) v(4) v(5) ];
elseif f==3, v = [ v(1) v(2) v(1) 0 0 0 v(3) v(4) v(5) ];
elseif f==4, v = [ v(2) v(1) v(1) 0 0 0 v(3) v(4) v(5) ];
elseif f==5, v = [ v(1) v(1) v(1) 0 0 0 v(2) v(3) v(4) ]; % sphere
end;
ofs=-(v(1:3).\v(7:9))'; % offset is center of ellipsoid
rotM=eye(3); % eigenvectors (rotation), identity = no rotation
g=1+(v(7)^2/v(1)+v(8)^2/v(2)+v(9)^2/v(3));
gain=(sqrt(g./v(1:3)))'; % find radii of the ellipsoid (scale)
end;
Alternative implementation for near spherical data with little or no rotation
function [ofs,gain,rotM]=ellipsoid_fit(XYZ)
% Fit a rotated ellipsoid to a set of xyz data points
% XYZ: N(rows) x 3(cols), matrix of N data points (x,y,z)
x=XYZ(:,1); y=XYZ(:,2); z=XYZ(:,3);
x2=x.*x; y2=y.*y; z2=z.*z;
D = [x2+y2-2*z2, x2-2*y2+z2, 4*x.*y, 2*x.*z, 2*y.*z, 2*x, 2*y, 2*z, ones(length(x),1)];
R = x2+y2+z2;
b = (D'*D)\(D'*R); % least square solution
mtxref = [ 3 1 1 0 0 0 0 0 0 0; 3 1 -2 0 0 0 0 0 0 0; 3 -2 1 0 0 0 0 0 0 0; ...
0 0 0 2 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; ...
0 0 0 0 0 0 1 0 0 0; 0 0 0 0 0 0 0 1 0 0; 0 0 0 0 0 0 0 0 1 0; ...
0 0 0 0 0 0 0 0 0 1];
v = mtxref*[-1/3; b]; nn=v(10); v = -v(1:9);
A = [ v(1) v(4) v(5) v(7); v(4) v(2) v(6) v(8); v(5) v(6) v(3) v(9); v(7) v(8) v(9) -nn ];
ofs=-A(1:3,1:3)\[v(7);v(8);v(9)]; % offset is center of ellipsoid
Tmtx=eye(4); Tmtx(4,1:3)=ofs'; AT=Tmtx*A*Tmtx'; % ellipsoid translated to (0,0,0)
[rotM ev]=eig(AT(1:3,1:3)/-AT(4,4)); % eigenvectors (rotation) and eigenvalues (gain)
gain=sqrt(1./diag(ev)); % gain is radius of the ellipsoid
Test code and sample output
[ofs,gain,rotM]=ellipsoid_fit([X Y Z]);
XC=X-ofs(1); YC=Y-ofs(2); ZC=Z-ofs(3); % translate to (0,0,0)
XYZC=[XC,YC,ZC]*rotM; % rotate to XYZ axes
refr = 500; % reference radius
XC=XYZC(:,1)/gain(1)*refr;
YC=XYZC(:,2)/gain(2)*refr;
ZC=XYZC(:,3)/gain(3)*refr; % scale to sphere
figure;
subplot(2,2,1); hold on; plot(XC,YC,'ro'); plot(X,Y,'kx');
xlabel('X'); ylabel('Y'); axis equal; grid on;
subplot(2,2,2); hold on; plot(ZC,YC,'go'); plot(Z,Y,'kx');
xlabel('Z'); ylabel('Y'); axis equal; grid on;
subplot(2,2,3); hold on; plot(XC,ZC,'bo'); plot(X,Z,'kx');
xlabel('X'); ylabel('Z'); axis equal; grid on;
器件 Datasheet 文档搜索
AiEMA 数据库涵盖高达 72,405,303 个元件的数据手册,每天更新 5,000 多个 PDF 文件