fitting 2d data set fit function is not working
5 views (last 30 days)
Asliddin Komilov on 1 Mar 2020
this is my data set and I wanted to try to get a fit for it.
well, did not work with
first it said: Dimensions of matrices being concatenated are not consistent.
then I made x and y the same length and
it said: Y must be a column vector.
And now I am stack. help please.
Thiago Henrique Gomes Lobato on 1 Mar 2020
Edited: Thiago Henrique Gomes Lobato on 3 Mar 2020
The problem is that your z data is defined in a grid while your x and y define only the vectors of this grid. If you first actually create the grid you will be able to create the model
[xmesh,ymesh] = meshgrid(x,y);
a = fit([xmesh(:),ymesh(:)],z(:),'poly23');
plot3(xmesh(:),ymesh(:), a([xmesh(:),ymesh(:)]),'*' )