When I try to test the null hypothesis that the data in the vector x are obtained from the Gaussian mixture model using the chi-square matching criterion, I get an error.
x = [trnd(20,1,50) trnd(4,1,100)+3];
GMModel = fitgmdist(x',2);
h = chi2gof(x, 'CDF', GMModel)
Error using chi2gof (line 216)
The 'cdf' value must be a ProbDist object, a function handle, or a cell array containing a function handle.