# Goal-seek kind of operation

Hi,

I wanted to know how the goal-seek kind of operation can be performed and automated in Igor. I have a set of data containing few thousands points. There are two variables which I want to find. The way it goes is:

Assume a value of 'x' and find 'y' using the mathematical formula 1

Now using 'y' find the value of 'x' using the mathematical formula 2

If both 'x' match, then that would the correct value, and if not use the new 'x' to do the operation again. The iteration goes on until both 'x' match.

Mathematical formulas use a number of variables that are part of those data points. So, for each set of data points there is a unique value of 'x' and 'y'. Imagine, I want to do this exercise with those few thousands time series data points.

Let me know if it doesn't make sense, and I'll try to explain it more.

Thank you

From your description it looks like you are looking for a function fitting operation:

`displayHelpTopic "curve fitting"`

The equivalent of a goal-seek type operation is FindRoots:

`displayHelpTopic "Finding Function Roots"`

but probably you need something like FuncFit.

I don't fully understand what you want to do. You have some data, but what does the data look like? and what is the relationship between x, y and your data?

Simple iteration can be done with a for loop. You assume a value for x and use that to calculate a more accurate x value. You use the more accurate value as your next guess giving you an even more accurate x value, etc... You should not need FuncFit for that.