i ve got quite simple function:
$f(t) = x1 * a(t) + x2 * b(t)$
and table of results like this one:
t | f(t) | a(t) | b(t) ---------------------- 1 | 2 | 5 | 3 ---------------------- 2 | 4 | 9 | -4 ---------------------- 3 | 10 | 12 | 5 ----------------------
And I need this to solve with NonlinearModelFit, Ive looked across the internet, but I was not able to find solve and plot function like this..
My (wrong, not functionall solution):
data = {{2,5,3}, {4,9,-4}, {10,12,5}
// This line will ends with error: Number of coordinates (3) is not equal to the number of variables (2).
nls = NonlinearModelFit[data, x1*y + x2*x, {{y, 0.3}, {x, -0.24}}, {y,z}}
// Next thing is problem with plot.. offcourse i can do sth like this:
f = { {1, 2}, {2,4}, {3, 10}}
// This plot is incomplete, because I was no able to find
// how to write x in data array :(
Show[ListPlot[f], Plot[nls[t,x,y], ...
I bet someone will find solution immediatelly, but Iam new in Mathematica.. Sorry for the dataset (i cant send full dataset, its bigger).
Thanks
EDIT:
Thank you very much to @jens_bo, I solve that with his help and his response. The main problem was caused by sharing variables across notebooks in mathematica... restart mathematica and everything works great :)