Plotting in 3D using dashed and solid lines for a given range of R2

2 ビュー (過去 30 日間)
MADHVI
MADHVI 2023 年 5 月 29 日
コメント済み: cr 2023 年 6 月 1 日
I need to plot for R2 using dashed line in [-5 0) and solid line in [0 5] in the same figure.
Thanks in advance.
hold on
for R2 = linspace(-5, 5, 100);
A = 0;
B = 0;
C = R2;
quiver3(A, B, C, 0, 0, ones(size(R2)));
% xlim([-1.5 1.5]);
% ylim([-1.5 1.5]);
zlim([-5 5]);
xlabel('A');
ylabel('B');
zlabel('C');
end
grid on;
hold off

回答 (1 件)

cr
cr 2023 年 5 月 30 日
You may call quiver3() twice in separate statements one with solid line spec and the other with dashed line spec.
E.g. as your C matrix is symmetric about 0,
hold on
for R2 = linspace(-5, 0, 100)
A = 0;
B = 0;
C = R2;
quiver3(A, B, C, 0, 0, ones(size(R2)),'--');
quiver3(A, B, -C, 0, 0, ones(size(R2)),'-');
% xlim([-1.5 1.5]);
% ylim([-1.5 1.5]);
end
zlim([-5 5]);
xlabel('A');
ylabel('B');
zlabel('C');
grid on;
hold off
  2 件のコメント
MADHVI
MADHVI 2023 年 5 月 30 日
Thank you.
cr
cr 2023 年 6 月 1 日
Please consider accepting the answer if it answered your question.

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

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by