nonlin_taylor.m

来自「非线型因素分析matlab仿真程序包」· M 代码 · 共 34 行

M
34
字号
function b = nonlin_taylor(a, nonlin)% TANH Hyperbolic tangent of a propability distribution%% The result is calculated using second order Taylor approximation% for expectation and first order for variance:%% E[res] = tanh(E[arg]) + 1/2 * tanh''(E[arg]) * Var[arg]% Var[res] = (tanh'(E[arg]))^2 * Var[arg]%% Copyright (C) 1999-2004 Antti Honkela, Harri Valpola,% and Xavier Giannakopoulos.%% This package comes with ABSOLUTELY NO WARRANTY; for details% see License.txt in the program package.  This is free software,% and you are welcome to redistribute it under certain conditions;% see License.txt for details.e = a.e;var = a.var;% Calculate first and second derivative of tanh at given point[val, d, d2] = feval(['d2' nonlin], e);% Multiply the multivar vectors, i.e. calculate%  m(:,i,:) = d .* a.multivar(:,i,:);[dim1 dim2 dim3] = size(a.multi);m = repmat(reshape(d, [dim1 1 dim3]), [1 dim2 1]) .* a.multi;b.e = val+.5*d2.*var;b.var = d.^2.*var;b.multi = m;b.extra = d.^2 .* a.extra;

⌨️ 快捷键说明

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