# How to match x of two functions f(x) and g(x) in order to plot f as a function of g

Dear,

It is certainly simple but I don't know how to do it.

I have an excel sheet with 4 coulumns: x1, f(x1), x2, g(x2)

x1 and x2 represents the same physical parameter but the incremental step is different, as for example:

x1             x2

0                   0

0.504             0.486

1.001               0.653

1.526             1.026

2.312                1.486

My question is how to find the rows where x1 match x2 with 1% of percentage of error in the sheet and delete all the other rows. So I can plot f as a function of g after that. I put my excel sheet in the attachment.

Chakib,

Hello ChakibO,

With 1% of percentage of error do you mean that you want to consider a 1% range of each value both for x1 and x2?

Thank you,

Cheers,

Vincenzo

Couldn't you do it like this, assuming you have two separate KNIME tables x1, f(x1) and x2, g(x2):

For each of the two tables:

• Use a Math Formula node to add a column to each table that rounds the x value to your chosen precision - e.g. ROUND(\$x1\$, 2)
• Use a GroupBy node to group on the rounded x value column and aggregate the f(x) or g(x) column - use the mean, or whatever aggregation makes most sense. The output from this node is a table with two columns, the rounded x value and the corresponding aggregated f(x) or g(x) value.

Now you can pass the two tables from the GroupBys into a Joiner node set to Inner Join on the two rounded x columns. The output will contain rounded x, f(x) and g(x).

Thank you Tom,

Indeed It works,

Chakib,