필터 지우기
필터 지우기

Curve fitting using custom model

조회 수: 2 (최근 30일)
Kyle Wang
Kyle Wang 2015년 7월 28일
댓글: Elias 2015년 7월 28일
Given set of x and y, how can I solve the parameter a, b and c in the model
y = a * x^b + c
to best fit the given data?
As I will further implement the algorithm in C++, I would prefer not using built-in Matlab functions to solve parameters.
Could anyone please suggest an algorithm? Many thanks, Kyle.
  댓글 수: 2
Walter Roberson
Walter Roberson 2015년 7월 28일
Are a and x certain to be non-negative ?
Kyle Wang
Kyle Wang 2015년 7월 28일
the given data set x_given and y_given are vectors of positive double numbers. a, b and c could be negative or positive.

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

채택된 답변

Walter Roberson
Walter Roberson 2015년 7월 28일
G = @(abc) sum((abc(1)*x0.^abc(2)+abc(3)-y0).^2);
ABC = fminsearch(G, [rand,rand,rand], 'MaxIters', 10000)
the result will not necessarily be exactly correct, and you can pass ABC back in instead of [rand,rand,rand], but I did find that with my test sometimes it cycled near the answer.
fminsearch is a gradient descent method.

추가 답변 (1개)

Torsten
Torsten 2015년 7월 28일
  댓글 수: 1
Elias
Elias 2015년 7월 28일
sounds interesting thanks

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

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by