How can I plot 2D contour and vector field (quiver)??

5 ビュー (過去 30 日間)
Dario Doronzo
Dario Doronzo 2017 年 5 月 4 日
回答済み: Star Strider 2017 年 5 月 4 日
if true
% code
endHi all,
I would like to know how it is possibile to plot a 2D contour with a tangential vector field.
In detail I have a given velocity profile V (matrix of n-m dimension) as function of X and Y (n-m dimension) and on this plot I want to have the tangential field (streamline) to the velocity field V.
MATLAB CODE :
clear all close all clc
[X,Y] = meshgrid(0:0.1:1,0:0.1:1); R = sqrt(X.^2 + Y.^2); V = 1+10*exp(-R.^2/(0.5^2));
figure; [Vxc Vxc]=contourf(X,Y,V,20); set(Vxc,'LineStyle','none'); colorbar;
Thank you very much

回答 (1 件)

Star Strider
Star Strider 2017 年 5 月 4 日
To use quiver with contour, see Show Gradient with Quiver Plot (link).
To use streamline functions, see Kelly Kearney’s approach in Finding normals to contours on contour plot (link). Her idea may be closer to what you want.

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by