I want to use a 4th dimension as color in quiver 3d plot.

2 ビュー (過去 30 日間)
Padma Naveena Ganapam
Padma Naveena Ganapam 2020 年 11 月 17 日
I have 3d vectors which I would like to plot in 3d space. I have a 4th parameter that specifies the characteristics of this 3d vector. Now I want to use color to specify this 4th dimension. I want to plot using quiver because i would like to see the arrow head.

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2020 年 11 月 17 日
You will find at least a couple of color-capable quiver-like submissions on the file exchange. For example: quiver3_c or quiver2.
HTH
  4 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2020 年 11 月 18 日
Well, the function is only 15 lines long, so shouldn't take too long to figure out. I'd change it to return q instead of n (which is a useless dummy-variable set to one.). That would give you the handles to the quivers as a variable. Then this example modified from the help of quiver3 seems to work OK:
[x,y] = meshgrid(-2:.2:2,-1:.15:1);
z = x .* exp(-x.^2 - y.^2);
[u,v,w] = surfnorm(x,y,z);
quiver3_c(x,y,z,u,v,w,x); hold on, surf(x,y,z), hold off
colorbar
caxis
% Returns:
% -0.4208 0.4208
% Let's modify it to the range of x:
caxis([min(x(:)),max(x(:))])
HTH
Padma Naveena Ganapam
Padma Naveena Ganapam 2020 年 11 月 18 日
thank you
that works

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by