Help with 3d matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Ale
le 13 Nov 2016
Réponse apportée : Walter Roberson
le 13 Nov 2016
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 commentaires
Réponse acceptée
Walter Roberson
le 13 Nov 2016
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!