Filter löschen
Filter löschen

I want to use contourf function to plot 2d velocity data

28 Ansichten (letzte 30 Tage)
Mandar Kadwekar
Mandar Kadwekar am 13 Jul. 2022
Kommentiert: Mandar Kadwekar am 14 Jul. 2022
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
Mandar Kadwekar
Mandar Kadwekar am 13 Jul. 2022
Thanks for your reply,
can I apply contourf if I have a a total velocity magnitude matrix dpendent on X&Y. I want to produce results similar to the picture I have attached.
Star Strider
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 13 Jul. 2022
Let u,v be your velcity matrices.
w = sqrt(u.^2+v.^2) ;
figure(1)
pcolor(x,y,w) ; % if throws error, transpose w
colorbar
shading interp
figure(2)
contourf(x,y,w)
  3 Kommentare
KSSV
KSSV am 14 Jul. 2022
It should show you arrow plots on pcolor. Attach your data and code.
Mandar Kadwekar
Mandar Kadwekar am 14 Jul. 2022
thanks for the help, I got the result now. I was just using wrong varaible.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by