Question

I have a set of reference data points to which I want to fit a sigmoidal curve. I can use the curve fitting tool of MATLAB to do this but I have a custom equation to fit to the data. The equation has 4-5 variables which I want to vary and then test for the goodness of fit.

I tried using the goodnessOfFitfunction for this. But it requires the test data and reference data matrices to be of the same size. The numbers of reference data points that I have are few (15-20) and the number of test points generated by using the custom equation is large.

Is there any other way by which I can check the goodness of fit of the curve? Or do I have find the test data points corresponding to the points in the reference data and then use the goodnessOfFit function (One problem with this approach is that I don't have the same resolution for the x axis in the test and reference data e.g. for a x-point 1.2368 in ref. data I have either 1.23 and 1.24 in my test data. I will have to round off the data and then calculate the fit).

Was it helpful?

Solution

do I have find the test data points corresponding to the points in the reference data and then use the goodnessOfFit function. I will have to round off the data and then calculate the fit).

Yes, buddy..! Seems like you have to do it in the hard way! :/

But instead of simply rounding off, you can find the two points in the test data just before and after the corresponding reference sample point. Then use linear interpolation to guess the value corresponding to the reference point.

Or easier, there is a resamplefunction in Matlab which would resample your test data to match your reference data. This would work if the reference data have a constant sample interval.

All the best!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top