Effacer les filtres
Effacer les filtres

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

5 vues (au cours des 30 derniers jours)
Asser Abdelgawad
Asser Abdelgawad le 20 Juin 2022
Modifié(e) : Sam Chak le 20 Juin 2022
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 commentaire
Torsten
Torsten le 20 Juin 2022
There is no parameter to be fitted within the sinc function...

Connectez-vous pour commenter.

Réponses (1)

Sam Chak
Sam Chak le 20 Juin 2022
Modifié(e) : Sam Chak le 20 Juin 2022
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-')

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by