Curve Fitting Techniques
8 ビュー (過去 30 日間)
古いコメントを表示
Hello everyone,
I have a project I'm working on which requires that I search a 3-parameter parameter space for a best fit curve. Unfortunately, the curve cannot be described by an explicit function. To generate the best fit, the process I have been using involves varying the 3 parameters, generating a test curve from the parameters, subtracting my experimental data, and then performing an RMS function to search for the lowest RMS value.
I'm wondering if there is any better way to do this, since my current method is a "brute force" method, where I search large sections of parameter space. This ends up taking hours to finish solving (reaching a stable minimum for RMS). For example, I know there is a built in least squares fit in MATLAB, but it requires that you provide a function with a Jacobian. Is there any similar process for non-explicit functions?
0 件のコメント
採用された回答
Bjorn Gustavsson
2011 年 7 月 26 日
fminsearch (and functions that use fminsearch such as John d'Errico's fminsearchbnd, and others on the file exchange) does not need explicit derivatives. As long as you can calculate the curve from your parameters you should be able to run a least-square-type minimization with those tools.
HTH
2 件のコメント
Bjorn Gustavsson
2011 年 7 月 27 日
Sure you're looking for a minimum of your _final_ function in the fitting of f(p,x,t) = p(1)*sin(p(2)*t+p(3)*x) to your empirical data (Y). What you do then is (in very mixed notation!):
min_p sum((f(p,x,t)-Y).^2)
That is a minimization. In matlab this is easily done:
p_optimal = fminsearch(@(p) sum((f_of_12eqs(p,x,t)-Y).^2),p0)
If you can automate the solving of your 12 equation, and those solutions are continuous and piecewise smooth in the parameters p then it is possible to make that into a function that will gove you Ymodel as a function of p, given x and t - and you're good to go.
その他の回答 (1 件)
Caleb Downard
2020 年 5 月 8 日
Super late on this but the regress function could work. it preforms regressional analysis on data sets so its a good way to find fitting constants. I'm not sure how it would work on trig functions because I'm not a math guy. I use it for analysising data sets with unkown fitting constants. I just used it to fit a fuction that was of the form y = m1*x1+m2*x2+c were x1 and x2 were two different arrays of data.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!