Using tabular data for Curve fitting of function z = f (x, y) with incomplete values of z. These blank z (i, j) automatically takes zero values and this is a problem
2 views (last 30 days)
Show older comments
Dear Community Members,
I have tabular data for data selection in the Curve fitter in the form of:.
I have to use curve fitter for z = f (x, y), but I don't have values for z(2, 4), z(3,3) and z(3,4) (red one).
In the workspase variable (matrix Z) these blank places automatically take values, which is zeros. Is there any instrument to ignore these zeros and the regression analyses to be made only with the available z values. In other words to ignore the three zero values in the down right corner? May be something with the weights instrument? If I simply use the matrix with zero values, without any additional actions, of course the regression method uses these z(2, 4) = 0, z(3,3) = 0 and z(3,4) = 0 and the results are unacceptable.
2 Comments
Torsten
on 23 Sep 2024
Supply z as a vector instead of a matrix and don't list these three data points in the vector. What's the problem ?
Accepted Answer
Torsten
on 25 Sep 2024
Edited: Torsten
on 25 Sep 2024
green = [5 5 5 5 5 4 4 4 4 1 1 1];
blue = [5 10 15 20 25 5 10 15 20 5 10 15];
yellow = [455 322 261 205 169 410 306 246 191 257 185 151];
F = @(p) fun(p,green,blue,yellow);
p0 = [1 1 1 1];
p = lsqnonlin(F,p0);
F(p)
norm(F(p))
a = p(1)
n = p(2)
b = p(3)
m = -p(4)/2
function res = fun(p,green,blue,yellow)
a = p(1);
n = p(2);
b = p(3);
m = p(4);
res = yellow - a*blue.^n.*((green+b).^2).^m;
end
0 Comments
More Answers (1)
Cris LaPierre
on 25 Sep 2024
I'd suggest using the standardizeMissing function to convert the 0 values to nan. The Curve Fitter app will ignore NANs.
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!