fminsearch Usage Question for function with 3 inputs
Ältere Kommentare anzeigen
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
Antworten (1)
Star Strider
am 22 Mär. 2018
0 Stimmen
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.
Kategorien
Mehr zu Interpolation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!