How can I use fminsearch() to apply a sinc function (sin(x)/x) fit on my data?

5 次查看(过去 30 天)
I am aware that fminsearch can be used to achieve this, but it is not intuitive to me how it can be done. Can someone provide an example? T

回答(1 个)

Sam Chak
Sam Chak 2022-6-20
编辑:Sam Chak 2022-6-20
How about considering the nonlinear least-squares curve fitting lsqnonlin?
fun = @(p) p(1)*sinc(p(2)*(xdata - p(3))) - ydata;
p0 = [p1, p2, p3];
p = lsqnonlin(fun, p0)
plot(xdata, ydata, 'r-', xdata, p(1)*sinc(p(2)*(xdata - p(3))), 'b-')

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by