dfdp.m

来自「此为频谱分析工具箱」· M 代码 · 共 36 行

M
36
字号
function y = dfdp(x,f,p,dp,func)% dfdp : Partials by finite differencies.%Syntax: df/dp = dfdp(x,y,p,dp,func)%% Returns the partial derivatives of function 'func'.% 'x'(vect) is x axis values, 'y' is y values, 'p' and 'dp' are parameters and% their variation. 'func' is the function concerned (y=func(x,p)).% output 'df/dp' is a vector(or matrix) of partials varying of 'dp'.% Author:  EF <manuf@ldv.univ-montp2.fr>% Description: partials computation% uses : vect2column% Part of 'Spectral tools'.x2 = x;x=vect2column(x);p0 = p; 		% save init paramsy = zeros(length(x), length(p));for i=1:length(p)	if (dp(i) == 0)		dp(i) = 0.00001;	end;	p(i) = p(i) + dp(i);	y(:,i) = (feval(func,x,p)-f)/dp(i);	p=p0;endif (size(x2,1) == 1)	y = y';end

⌨️ 快捷键说明

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