Problems with minimizing a function
Show older comments
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?
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!