Two dimensional weight function for curve fitting
2 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!