I have this matrix that I need to interpolate, so I'm using griddata for that.
Nonetheless it keep giving me the following error:
Error using griddata (line 110)
The lengths of X and Y must match the size of Z.
The thing is I've checked all it and my "X" (yys1) and "Y"(zzs1) should be the rigth lengths for "Z"(AAA). yys1 is a 57×1 double, zzs1 is a 99×1 double, while AAA is a 57×99 double. XIT and ZIT are a new grid to which the values need to be interpolated, these are 1001×2002 double.
See the code I typed in the workspace below and the error it gives, I would appreciate any and all help 😉
>> griddata(yys1,zzs1,AAA,XIT,ZIT,'natural');Error using griddata (line 110)The lengths of X and Y must match the size of Z. >> griddata(yys1,zzs1',AAA,XIT,ZIT,'natural');Error using griddata (line 110)The lengths of X and Y must match the size of Z. >> griddata(yys1',zzs1,AAA,XIT,ZIT,'natural');Error using griddata (line 110)The lengths of X and Y must match the size of Z. >> griddata(yys1',zzs1',AAA,XIT,ZIT,'natural');Error using griddata (line 110)The lengths of X and Y must match the size of Z. >> length(yys1)ans = 57>> length(zzs1)ans = 99>> size(AAA)ans = 57 99
Thus in otherwords I have no clue what I'm doing wrong, could someone please point out what mistake I'm making or why matlab is throwing this error?
Best Answer