deltab.m

来自「核磁共振谱仪的匀场仿真程序。仿真了比较简单的匀场过程」· M 代码 · 共 25 行

M
25
字号
function B=deltaB(x,y,z,P,varargin)
% do not check the currents set P
% deltaB will be not greater than Bmax
% P should be int, and vary by 1 as the step
l=length(varargin);
B0max=1;
Cmax=512;

if l==1
    B0max=varargin{1};
elseif l==2
    B0max=varargin{1};
    Cmax=varargin{2};
end

xmax=0.4;
ymax=0.4;
zmax=4;
x=x/xmax;
y=y/ymax;
z=z/zmax;

B=P(1)*z+P(2)*x+P(3)*y+P(4)*z^2+P(5)*z*x+P(6)*z*y+P(7)*x*y+P(8)*(x^2-y^2);
%B=B+P(9)*x^3+P(10)*y^3+P(11)*z^3*x+P(12)*z^3*y+P(13)*z^3+P(14)*z^4+P(15)*z^5;
B=B0max*B/Cmax;

⌨️ 快捷键说明

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