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

2 vues (au cours des 30 derniers jours)
MADHVI
MADHVI le 29 Mai 2023
Commenté : cr le 1 Juin 2023
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

Réponses (1)

cr
cr le 30 Mai 2023
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 commentaires
MADHVI
MADHVI le 30 Mai 2023
Thank you.
cr
cr le 1 Juin 2023
Please consider accepting the answer if it answered your question.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by