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

📄 dlinmin.m

📁 matlabwsn定位仿真程序
💻 M
字号:
%| FUNCTION: dlinmin
%|
%| PURPOSE:  Given an n-dimensional point p[1..n] and an 
%|   n-dimensional direction xi[1..n], moves and resets p to where 
%|   the function func(p) takes on a minimum along the direction xi 
%|   from p, and replaces xi by the actual vector displacement that 
%|   p was moved. Also returns as fret the value of func at the returned 
%|   location p. This is actually all accomplished by calling the
%|   routines mnbrak and brent.
%|
%| REFERENCE:  Numerical recipes in C
%|

function [p, xi, fret] = dlinmin(p, xi, func, dfunc)

TOL    = 2.0e-4;  % Tolerance passed to brent.

global pcom xicom nrfunc nrdfun;
nrfunc = func;
nrdfun = dfunc;
pcom   = p;
xicom  = xi;

ax     = 0.0;  % Initial guess for brackets.
xx     = 2.0;
[ax, xx, bx] = minBracket(ax, xx, 'f1dim');
[fret, xmin] = dbrent(ax,xx,bx,'f1dim', 'df1dim',TOL);

xi     = xi.*xmin;
p      = p + xi;

⌨️ 快捷键说明

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