Alternatively, you can create a vector of function values and apply DIFF, i.e.xValues = 2:0.1:4;fValues = fx(xValues);df = diff(fValues)./0.1;请注意,diff采用前向差,并且假定dx等于1.Note that diff takes the forward difference, and that it assumes that dx equals to 1.但是,根据您的情况,最好将fx定义为多项式,并评估函数的导数,而不是函数值.However, in your case, you may be better off to define fx as a polynomial, and evaluating the derivative of the function, rather than the function values. 这篇关于如何在Matlab中评估函数的导数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 00:26