如何使用fminbnd计算最大值?。
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
有一些离散的点,通过拟合后得到了函数曲线,并且计算了该曲线的曲率方程,问怎么使用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);总是出错,不知道问题在哪里。
求大佬指点一下。
0 commentaires
Réponse acceptée
peqxycu
le 19 Mai 2023
Curl = matlabFunction( cur1 );
[ xmin, fval ] = fminbnd( Curl, 1, 101 )
xmin = 72.5035065055403
fval = 8.03520341250956e-09
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Thermal Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!