Curve fitting with two variables
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi community!
I have y = f(x), and z = f(x,y), now i want to fit z vs y and need final graph like z vs y. In general, it can be simply done by replecing x by its y equivalent in z but here it is not possible since x-variable is in the integral.
Thank you for your help!
11 Kommentare
Antworten (1)
William Rose
am 28 Dez. 2021
Bearbeitet: William Rose
am 28 Dez. 2021
Here is a sample solution. It uses calcZ(), which I posted previously, and it uses the simulated data file which I posted previously. The main program is fitKKJ.m. It calls fmincon() and it passes function sseZY() to fmincon(). Function sseZY is attached. There are comments in fitKKJ.m and in sseZY.m which explain how each works.
Here is the console output when I run the script:
fitKKJ
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in
feasible directions, to within the value of the optimality tolerance,
and constraints are satisfied to within the value of the constraint tolerance.
<stopping criteria details>
Best fit values: a=0.771, x=0.047.
The simulated data (ten y,z pairs) was generated with a=1, x=0, and Gaussian noise was added.
The script also plots the measured (or simulated, in this case) data and the best-fit approximation. See plot below.

Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

