Help with 3d matrix
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I'm learning to use matlab, and I have a problem, I've been trying to do a matrix 3d with the next sizes: X and Y which are 76x88, and and Z is 24x1. And I did:
[x,y]=meshgrid(X,Y);
[x,y,z]=griddata(X,Y,Z,x,y)
But.... x and y returns like 6688x6688, and the griddata gives me a error in the sizes from de matrices... what can I do ?
0 件のコメント
採用された回答
Walter Roberson
2016 年 11 月 13 日
vq = griddata(x,y,v,xq,yq)
For that syntax, x, y, and v need to be vectors.
Your equivalent to v, Z in your code, is a vector of length 24 x 1, which is fine in itself.
Your x and y start out at 76 x 88 . Neither of those are vectors. They also are not multiples of length 24 (your Z). Your x and y need to be the same length as your z.
Now, if you had an x which was 76 x 88, and a y which was 76 x 88, and a z the same size, then you could
griddata(x(:), y(:), z(:), xq, yq)
for some xq, yq
Your variables give the impression that you have data for a single X/Y plane, and you have a vector of Z values that you want to make predictions at. That is not going to work: you (x, y, z) triples as input to make predictions against.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!