📄 dfdp.m
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -