Creating surface plot from 3 coloum Matrix?

6 visualizzazioni (ultimi 30 giorni)
Good day together,
I would like to know if it is possible to create a surface plot using matlab from a 3 coloum matrix with different X and Y values. To be a bit more clear here is an example of how the data would look:
X Y Z
2000 20 rand
2000 40 rand
2000 60 rand
2500 30 rand
2500 50 rand
2500 70 rand
3000 20 rand
3000 60 rand
I found an answer here: https://de.mathworks.com/matlabcentral/answers/412639-creating-surface-plot-from-a-matrix-with-3-columns but this seems to only work when you always have the same Y values for each X step or at least the same amount of Y for each X value.

Risposta accettata

Niklas Federkeil
Niklas Federkeil il 16 Apr 2021
I solved the issue by creating a matrix with all the unique x and y values filling this with the corresponding z value and then filling the empty spaces with NaN. This way I am able to use the contourf for plotting.
from example
2000 2500 3000
20 rand NaN rand
30 NaN rand NaN
40 rand NaN NaN
50 NaN rand NaN
60 rand NaN rand
70 NaN rand NaN

Più risposte (0)

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by