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

1 view (last 30 days)
MADHVI on 29 May 2023
Commented: cr on 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
##### 0 CommentsShow -2 older commentsHide -2 older comments

Sign in to comment.

### Answers (1)

cr on 30 May 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 CommentsShow NoneHide None
MADHVI on 30 May 2023
Thank you.
cr on 1 Jun 2023
Please consider accepting the answer if it answered your question.

Sign in to comment.

### Categories

Find more on Lighting, Transparency, and Shading in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!