non linear parameter estimation least squares

조회 수: 2 (최근 30일)
Alex
Alex 2011년 7월 6일
I have the following equation that i want to find the parameters c1, c2 and c3.
E = SUM(yj-(1/(c1*c2))*(c3-asinh(sinh(c3)*exp(c1*j*2*pi))))^2
yj is consecutive timings for a tennis ball, on a string revolving around a pole (the ball cannot change height)
I have found some help with this:
x = [ 1,2,3,4,5 ];
y = [ 2.2, 1.9, 1.7, 1.5, 1.4];
a11 = sum(x.^2); a12 = sum(x); a21 = sum(x); a22 = sum(ones(1,length(x)));
A = [ a11,a12; a21,a22] % the coefficient matrix of the minimization problem
c1 = 1;
c2 = 1;
c3 = 1;
diff_c1 = (c3-asinh(exp(2*pi*x.*c1).*sinh(c3)))/(c1^2*c2)+(2*x.*pi*exp(2*c1*x.*pi).*sinh(c3)*asinh(exp(2*c1*x.*pi).*sinh(c3)))/(c1*c2)
diff_c2 = (c3-asinh(exp(2*c1*x.*pi).*sinh(c3)))/(c1*c2^2)
diff_c3 = (exp(2*c1*x.*pi).*cosh(c2)*asinh(exp(2*c1*x.*pi).*sinh(c3))-1)/(c1*c2)
b1 = sum(diff_c1*y); b2 = sum(diff_c2*y); b3 = sum(diff_c3*y);
b = [ b1; b2; b3 ] % right-hand-side of the minimization problem
c = A \ b % solution of the minimization problem
xApr = 0 : 0.001 : 1; yApr = c(1)*xApr + c(2);
plot(x,y,'*g',xApr,yApr,'b');
Basically diff_c1,c2,c3 are the parts multiplied by the data values yj for least squares minimization, i think this is correct. b1,2,3 are these multiples.
I think the problem is I haven't got my '.''s in the correct place. I know that they are required to say do this for all x and y's but Im not sure exactly where they are required.
I have posted this here because I would also appreciate some help as to whether I am doing this the correct way - because I also require initial values of c1,2,3 which i have stated as 1 but again I am not sure if I have done that correctly
  댓글 수: 1
bym
bym 2011년 7월 6일
is there some reason you are not using function like lsqcurvefit ?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by