Problems with minimizing a function
Afficher commentaires plus anciens
I need to fit some parameters using the fminsearch command. my plot is the following one.
function fit
load R75
x=ang
y=int
p0=[ 1 1 1]
[p,fval]=fminsearch(@err,p0,x)
p
function err=S(x,p)
S=norm(ycalc-y)
function calc= ycalc(p,x)
ycalc=p(1)*(cos((pi/180)*(x-p(2))))^2+p(3)
x and y are data I load from file R75. What I want to do is to find the values of p that minimize the error S between experimental and calculated value. However I have problems doing this. Can anybody help me?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!