Problems with minimizing a function
显示 更早的评论
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?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!