如何使用fminbnd计算最大值?。
Show older comments
有一些离散的点,通过拟合后得到了函数曲线,并且计算了该曲线的曲率方程,问怎么使用fminbnd找到曲率的最大值。程序只写出了一部分。如下:
p1 = polyfit(x1,y1,6); %拟合的系数
f1 = poly2sym(p1); %拟合的函数
xt = linspace(min(x1), max(x1));
yt1 = polyval(p1, xt);
plot(xt, yt1, 'r-', 'LineWidth', 1);
%曲率计算
yapp1 = diff(f1);
yapp2 = diff(f1,2);
cur1 = abs(yapp2) ./ (1+yapp1.^2).^(3/2);
然后使用fminbnd计算曲率cur1在【1,101】区间的最大值,我用的[xmin, fval]= fminbnd(cur1,1,101);总是出错,不知道问题在哪里。
求大佬指点一下。
Accepted Answer
More Answers (0)
Categories
Find more on Thermal Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!