fminsearch Usage Question for function with 3 inputs
Mostrar comentarios más antiguos
I am writing code to find the best fit of a sine function to NMR spectra. There are several superimposed sine functions from noise in the data (called the FID).
I have a function called fitFun that takes in the initial guess (IG), frequency (nu), and latest FID, and returns the coefficients (b,d,c) of the best fit for the function: b*sin(2*pi*(nu+d)+c). I want it to hold FID and frequency constant, and return only the best fit initial guess.
When I tried calling fminsearch(@fitFun,[IG,nu,FID]), I get horizcat error, and vertcat error for using ;.
Is there a better way to do this? Is fminsearch an appropriate function to call for this?
Thanks
Respuestas (1)
Star Strider
el 22 de Mzo. de 2018
0 votos
See if the solution in Curve fitting to a sinusoidal function (link) works for you. It is essentially what you are doing. You can tweak the code to do what you want.
Categorías
Más información sobre Interpolation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!