putting function values in meshgrid format
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
skuznet
am 2 Mai 2018
Kommentiert: Star Strider
am 2 Mai 2018
I have coordinate vectors X and Y and corresponding vector of function values Z. Points (Xi,Yi) are distributed irregularly on plane. I'm trying to convert these points to a regular mesh with constant spacing, calculate corresponding values Z and plot them using surf. What is the best way to do it in matlab? I was looking at interp2, but it requires data in meshgrid format.
Thanks!
0 Kommentare
Akzeptierte Antwort
Star Strider
am 2 Mai 2018
Your data may already be gridded. I would first plot it using stem3, for example:
figure
stem3(X, Y, Z)
grid on
If it appears that the data are regularly spaced with respect to ‘X’ and ‘Y’, then you only need to use reshape to create matrices from your vectors. If you then want to interpolate it, the griddata function may be easiest to use.
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interpolation 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!