I want to use contourf function to plot 2d velocity data
Ältere Kommentare anzeigen
I have the x,y and corersponding velocity components u and v as a matrix data. I want to use this matrix data to plot a contour of velocity.
I went tried already using the Matlab database but I don't get epected results. It is hard to interpret the code given in the database, do if anyone can help to relate the code with the velocity data I have would be a big help.
3 Kommentare
Walter Roberson
am 13 Jul. 2022
Velocity is a vector valued quantity, so it is not clear to me that plotting a contour makes sense. Consider that your x is an independent dimension and your y is an independent dimension, and your u and v are each dependent dimensions. That is four total dimensions, but a contour plot only makes sense for two independent dimensions and one dependent dimension. Unless, that is, you want to try the somewhat weird possibility of using contour3 by making one of the dependent dimensions into an independent dimension, such as
contour3(x, y, u, v) %x, y, u are being treated as independent dimensions and v as dependent dimension
Mandar Kadwekar
am 13 Jul. 2022
Star Strider
am 13 Jul. 2022
Without the data themselves to work with, the only suggestion I have is to create a vector from ‘u’ and ‘v’ using the hypot function. It is relatively straightforward to interpolate ‘x’, ‘y’, and the resulting magnitude vector created by hypot to matrices to use with contourf.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Contour Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!