Merge vector to matrix
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all,
I have three vectors - X and Y. Vector three (Z) is the solution for X and Y (see picture attached). I want to convert these three vectors to a matrix that I can plot 3-D surfc. X and Y are the parameters and Z is the solution in the matrix.
How can I do that?
Thanks.
Idan
0 Commenti
Risposte (1)
dpb
il 22 Apr 2020
In what form do you have the data to start with? If it's a file with the content of the document shown, then just read the file into an array or table to start with instead of creating multiple variables ("It's the MATLAB way!")
tZYZ=readtable('yourfile.dat');
will leave you with a table with variable names of X, Y, Z[V] and you can then reshape() by the grid size to match the necessary meshgrid interleaving...let's see what that looks like---eww! that's a bugger! The grid spacing is not regular along the X direction for the steps of Y; that doesn't fit the rules for surfc of a regular x/y grid.
I think you'll have to either be able to build a regular grid that bounds the range of X,Y in the data and infill what you have for locations with NaN for the missing Z values or use one of surface interpolating functions for scattered surface and see if can interpolate to the regular mesh.
Sorry I don't have the time to try to dig further right now; maybe somebody else will come along soon for the rest...
2 Commenti
dpb
il 22 Apr 2020
Well processing the data shouldn't be difficult at all as long as you don't need the regular mesh but just operate on either all or pieces of the data vectors.
I'm certain it's doable; I just have other fires to put out right now so don't have much time to put in to anything can't just answer otomh, sorry.
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!