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

2 Ansichten (letzte 30 Tage)
MADHVI
MADHVI am 29 Mai 2023
Kommentiert: cr am 1 Jun. 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

Antworten (1)

cr
cr am 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

Kategorien

Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by