Two dimensional weight function for curve fitting

Hi! I'm fitting a matrix with a normal distribution using curve fitting toolbox. I want to add a weight function. Unfortunatly, I have found manuals only for 1-d weight function. I have a 2xN array with weight for X an Y (wts)
opts=fitoptions('Weights',wts);
gauss2 = fittype( @(a1, sigmax, sigmay, x0,y0, x, y) a1*exp(-(x-x0).^2/(2*sigmax^2)-(y-y0).^2/(2*sigmay^2)),...
'independent', {'x', 'y'},'dependent', 'z' );
wsf = fit([X,Y],double(Z),gauss2,opts);
And I get an error
Error using curvefit.basefitoptions/set
Matrix must be column or row vector.
Any ideas how to make a two dimensional weight function for curve fitting?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by