- Bisection method
- False position (regula falsi)
- Interpolation
- Newton's method (and similar derivative-based methods)
- Secant method
- Steffensen's method
- Inverse interpolation
How to find 3 unknows with Least square a*cosh(b*x)+c, not using toolbox?
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a least square problem with the equation a*cosh(b*x)+c, where the problem lies in that I do not know how to solve the unfamiliar each separately. I have solved the problem with fminsearch and fittype (toolbox) but I want to solve it without the toolbox.
If it would be a+cos(b*x) I would know how to solve it. Here i got stuck because if i proceed with this(and make it work...) i would only end up with the constans a and c, like you would with a regular 2nd degree polynomial. So to the question: How do i determine a,b and c with the help of the dataset x and y, That is using method of least squares to interpolate/approximate f(x) in regards to the data and not using toolbox like the above and lsqcurvefit?
with regards P
The x and y values are in a separate file.
data = load('koordinater');
x = data.x;
y = data.y;
g = fittype('a*cosh(b*x) + c','coeff',{'a','b','c'});
options = fitoptions(g);
fitobject = fit(x',y',g,options);
MKAM = (fitobject.a)*cosh((fitobject.b)*x) + fitobject.c;
댓글 수: 0
채택된 답변
Jan
2019년 1월 16일
You have a system of equations:
a * cosh(b * x) + c - y = 0
with x and y are the given. Now you search the least-squares-solution, which finds [a,b,c] such that the equations are solved as good as possible.
You can use a set of different root finding algorithms, see https://en.wikipedia.org/wiki/Root-finding_algorithm:
I assume that you have learned something about one or more of these methods and the purpose of this homework is to implement it. We cannot guess, which one is preferred, but you can and should ask your teacher.
댓글 수: 4
Walter Roberson
2019년 1월 20일
Your code does not make much mathematical sense unless bx, x, and sbx are column vectors. However if they are column vectors then you cannot just append 1 and have it work: you would need to append a vector of 1's.
J = [bx(:) a*x(:).*sbx(:) ones(numel(x),1)];
h = J\f(:);
p = p - reshape(h, 1, []);
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!