Help with 3d matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ale
am 13 Nov. 2016
Beantwortet: Walter Roberson
am 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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!