New user of 'cftool box' here. I am trying to fit an experimental dataset to extract few parameters. One of the parameter is also function of x. How to retrieve this parameter? Because most of the cftool examples show the fitting with real value coefficients. I appreciate any response. Thanks.

*As you can see, I am using an 'user defined function' to fit the data to determine n2,daSi,theta_in. But since the n2 is function x, I would like determine that with respect each x data point. I think it is appropriate to say that the input n4 and n3 are also x dependent, for simplicity I am considering average value. So how I can accommodate these inputs. I tried an extra user defined function inside this code to extract n3(=f(x)), but it doesn't work.

I might have missed it, however, how is n2 defined or assigned? Also you mentioned that n3 and n4 values are being averaged out. How are they defined? or what are they being averaged from i.e. a range dependent on x based on a function?

Hi Shruti, What I mean by averaging n3 and n4 is that, they are x dependent values, but I consider an average of them. Assuming this, when I fit the y vs x I get n2 which is also averaged over x. But I am trying to improve fitting. So I want include inputs that are x dependent, therefore I would like determine parameter that are x dependent. Does it make sense?

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

## 2 Comments

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/343740-curve-fitting-with-coefficient-as-function-of-x#comment_459888

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/343740-curve-fitting-with-coefficient-as-function-of-x#comment_459888

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/343740-curve-fitting-with-coefficient-as-function-of-x#comment_460132

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/343740-curve-fitting-with-coefficient-as-function-of-x#comment_460132

Sign in to comment.