# Fitting TGraph / TF with data like x(z), y(x(z))

Hi rooters,

I am trying to fit measurement data.
(measured data is rather simple, as is the model)
However, I am struggling with the fit.

Two quantities were measured - lets call them x and y.
Plotting works and looks fine.

My model now gives me x and y as a a function of z and x(z).
y is function of x (which is again a function of z).
x is function of z and of simple (e.g. pol5) nature, but not invertible (i.e. I am not able to write y as a function of z )

So my graph looks like:
TGraph=TGraph(x(z) , y(x))

Is there an easy approach to fit my data and determine the coefficients of x(z)= pol5?

Regards
Markus

HI ,

I am not sure if I have understood you correctly. You want to find the parameters of the function relating X to Z.
So X is not an independent variable, but a dependent one (on Z). Do you measure the variable X for different Z values ?
If this is the case, why you don’t fit directly X = f(Z) and forget about Y ?
Or if you measure also Y given X and you now the Y(X) relation, you can maybe do a combined fit of the X and Z data.

If I have misunderstood your use case, I concrete example might be useful

Best Regards

Lorenzo

Excuse me… of course you are right… a simple example is always needed.

let the model be:

x(z)= c_00+c_01z+c_02z2+c_03*z3+c_04z**4+c_05z5
y(x) = c_10+c_11x+c_12x
2+c_13x**3+c_14x4+c_15*x5

For the model:
c_10, c_11, c_12, c_13, c_14, c_15 are known
c_00, c_01, c_02, c_03, c_04, c_05 are fit parameters

what I measure is: x and y -> lets say y as a function of x

However, z is needed (the model) and it is not possible to invert x(z) to rewrite y(x) as y(z).

Hi

Can you elaborate more on the X and Y measurements ? You measure Y given X, or you measure Y and X independently ? Do you know z, when you measure X (or Y) ?
Again a descriptive example would be useful…

Lorenzo